< back
valid html5 valid css3

CSS stars!

I had this idea for a while to randomly generate a starfield in the page's background using javascript and css (with, of course, varying sizes and brightnesses for each star). That would save you from having to load in all those tiny details from an image file, which I know from experience either looks bad (as an artefacty jpeg), or takes up 800kb+, or way more as a pixel-perfect PNG. Plus, an image would be forever static – the stars would never change.

So I coded it. It didn't take long to write. You can see the end result on this page; look carefully at the background. Stars will fade into and out of existence slowly over time. Code is here if you want to take a look (it uses Prototype library, but would be easily portable to other libs). The end result is too performance intensive to use throughout the site (we're talking thousands of tiny HTML divs having their opacity properties animated continuously), but was a satisfying experiment, and shall live on through this page.

(•_•)( •_•)>⌐■_■(⌐■_■)