Dynamic CSS (DCSS)

Dynamically altered CSS is something I have had going around in my head for about three years. Ever since I built the original Simon and Paula Garden website I always wanted to change the CSS depending on the context.

Dynamically altered CSS is something I have had going around in my head for about three years. Ever since I built the original Simon and Paula Garden website I always wanted to be able to change the CSS depending on the weather. It was not possible at that point but I am now many steps closer to it.

The main way of changing CSS is via the DOM. I have used getElementById to change the values of the CSS as the page loads by picking up a random stock price and the hour of your PC. You can see this in my fully functional Sundial Dynamic CSS experiment. You will notice that during the day the position of the sun in the background graphic will change. At night the background is dark as are the hills. The stock feed panel background changes colour depending on the price change on the day - if the price is going up it is green and if down then red.

I intend to take this further by making the next version of this site change its appearance depending on the local weather in Croydon!

By Simon Cox | Published: Fri, May 7, 2004 Shorticles | CSS | Web

Next short: Albunuelas Spain May 2004

Previous short: Bopspam right on the head

Latest Shorticles

Or all the short articles

Latest Articles

Or all the articles