Advent calendar

  • Written by: Marko Samastur
  • Published on:
  • Category: Catchall, Web

I started creating digital advent calendars for my loved ones a few years ago, but missed the last couple of years because we were travelling. I would collect or create interesting content. For the first 24 days of December they could open that day's window or a previous one and see a small surprise.

My visual design skills are limited, so I was always bothered by my calendar's look. This year I finally got around to improving it with the help of AI, which wrote most of the code and especially the SVGs.

I did spend a lot of time getting houses to work exactly as I wanted. There are 24 days to cover, which can be divided by 2, 3, 4, 6 and 8. So depending on your viewport size, you may see 1, 2, 3, 4 or 6 houses (8 would be visually unbalanced). It is also not difficult to do with (sub)grid and custom properties.

The other thing I wanted to mimic from advent calendars one buys in shops is the random order of windows. I specifically wanted the order in HTML to be correct and make just the visual order random, as I think otherwise it would just suffer from poor accessibility. I did not manage to get it working with CSS's random() function, but it is also not yet widely available, so I don't feel disappointed.

It is probably a bit late for this year, but here it is, free to customise and use:

See the Pen Advent Calendar by Marko Samastur (@markos) on CodePen.