All We Want for Christmas is Our CSS …

Share this article

You’ve no doubt been following our 2012 SitePoint Christmas Sale – a winterland-themed design extravaganza (desktop version only). Elements on screen that have unfolded day by day have included ice skaters to a dancing bear to leaping fish to a smoking locomotive — and there’s plenty more to come. 4 screenshots from Xmas.sitepoint.com Now we’re adding a “Christmas story mode” to this project, for those of you keen to drill down into the story stream. Head on over to https://xmas.sitepoint.com/story/css to see the current day’s story minus the normal sales page for that day. You can also link directly to specific days by adding “#day/” and the day number. For instance, this link will take you straight to day 14: https://xmas.sitepoint.com/story/css#day/14

All About the Design

The concept, layout and illustration are the brainchildren (if that’s a thing … yeah, it is!) of Harley Alexander. As he explained in this post, Michael Sauter built our backend. Ian Coleman made it all the bits work together and Jude Aakjaer managed both the team and the project. The animation was down to me. I love mucking about with animations, and the Christmas sale has been the perfect place to workshop new ideas. No, it won’t work on non-current browsers. Yes, it’s also true that some scenes may push your CPU a little. My challenge was:
  1. To rely on pure CSS3 animation, without heavy use of JavaScript
  2. To find as many different CSS animation approaches as I could
And I barely had to bend those rules. For instance: 1) The dogsled is positioned with CSS (position:fixed) and uses CSS transitions
to move it into place. However, I had to add and subtract a class to make the dogs trot. 2) You’ll also notice the smoke on the train animation on days 5, 6 and 7 detaches from the train as soon as it leaves the smokestack – just like real smoke! I needed a little dash of JavaScript to calculate where the chimney is relative to the track, and then place each new puff of smoke relative to that position on the track – rather than the train. So really, JavaScript is being used an animation toggle, rather than the animation engine. If you’re interested in the CSS nitty-gritty of this project, join the conversation in our Christmas CSS Podling group. I’ll be hanging around there, answering questions and getting your feedback on what worked best. I’ll also be writing up some longer animation how-to posts in the new year on SitePoint … so keep an eye out for those. In the meantime, check out each new day and let us know what you think.

Frequently Asked Questions (FAQs) about CSS Christmas Effects

How can I create a snowfall effect using CSS?

Creating a snowfall effect using CSS involves creating a div for the snowflakes and using CSS animations to make them fall. You can create multiple snowflakes and give them different sizes and speeds to create a more realistic effect. The keyframes animation property is used to create the falling effect, and the transform property is used to move the snowflakes across the screen. You can also use the opacity property to make the snowflakes fade in and out, creating a more realistic snowfall effect.

Can I use CSS to create a Christmas lights effect?

Yes, you can use CSS to create a Christmas lights effect. This involves creating a series of divs for the lights and using CSS animations to make them blink. You can use the animation property to create the blinking effect, and the background-color property to change the color of the lights. You can also use the border-radius property to make the lights round, and the box-shadow property to give them a glowing effect.

How can I create a Christmas tree using CSS?

Creating a Christmas tree using CSS involves creating a series of divs for the branches and using CSS properties to shape them into a tree. You can use the border property to create the triangular shape of the branches, and the background-color property to color them. You can also use the ::before and ::after pseudo-elements to create additional branches and decorations.

Can I use CSS to create a Santa Claus animation?

Yes, you can use CSS to create a Santa Claus animation. This involves creating a series of divs for the different parts of Santa Claus, and using CSS animations to make them move. You can use the transform property to move and rotate the divs, and the animation property to create the movement. You can also use the border-radius property to shape the divs into the different parts of Santa Claus.

How can I create a Christmas countdown using CSS?

Creating a Christmas countdown using CSS involves creating a div for the countdown and using CSS properties to style it. You can use the font-size property to change the size of the countdown, and the color property to change its color. You can also use the text-align property to center the countdown. To create the countdown itself, you would need to use JavaScript.

Can I use CSS to create a Christmas card?

Yes, you can use CSS to create a Christmas card. This involves creating a div for the card and using CSS properties to style it. You can use the border property to create the outline of the card, and the background-color property to color it. You can also use the box-shadow property to give the card a 3D effect, and the transform property to rotate it.

How can I create a Christmas star using CSS?

Creating a Christmas star using CSS involves creating a div for the star and using CSS properties to shape it. You can use the border property to create the outline of the star, and the background-color property to color it. You can also use the transform property to rotate the star, and the box-shadow property to give it a glowing effect.

Can I use CSS to create a Christmas ornament?

Yes, you can use CSS to create a Christmas ornament. This involves creating a div for the ornament and using CSS properties to style it. You can use the border-radius property to make the ornament round, and the background-color property to color it. You can also use the box-shadow property to give the ornament a 3D effect, and the transform property to rotate it.

How can I create a Christmas banner using CSS?

Creating a Christmas banner using CSS involves creating a div for the banner and using CSS properties to style it. You can use the width and height properties to size the banner, and the background-color property to color it. You can also use the text-align and font-size properties to style the text on the banner.

Can I use CSS to create a Christmas fireplace?

Yes, you can use CSS to create a Christmas fireplace. This involves creating a series of divs for the different parts of the fireplace, and using CSS properties to style them. You can use the border and background-color properties to create the bricks, and the box-shadow property to give them a 3D effect. You can also use the transform property to shape the divs into the different parts of the fireplace.

Alex WalkerAlex Walker
View Author

Alex has been doing cruel and unusual things to CSS since 2001. He is the lead front-end design and dev for SitePoint and one-time SitePoint's Design and UX editor with over 150+ newsletter written. Co-author of The Principles of Beautiful Web Design. Now Alex is involved in the planning, development, production, and marketing of a huge range of printed and online products and references. He has designed over 60+ of SitePoint's book covers.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week