Forum Moderators: not2easy
I have a way of specifying date-sensitive CSS. I apply a series of classes to my <body> element that correspond to the day, like so:
<body class="date_h_08 date_wd_Mon date_d_15 date_m_01 date_y_2007 date_dm_15_01 date_my_01_2007 date_dmy_15_01_2007"> This way, I can specify a special "heart" background on Valentines Day, like so:
body.date_dm_14_02 div#maincontent
{
background-image: url(mushy_heart_background.gif);
} Now, as you can see, that <body> element is just a tad long-winded. I had to construct a series of styles in order to give designers using my sites as many choices as possible.
Here's my question: Is it possible to have specific CSS keyed to more than one "container class"? For example, can I have something like this:
body.date_d_14 body.date_m_02 div#maincontent
{
background-image: url(mushy_heart_background.gif);
} I can try testing stuff out at some later time (I can't spend much time on it right now). However, there are some real heavyweights on this thread, so I figured I'd ask first.
DUH: That's "Inheritance."
Do you mean selecting multiple classes? If so;
body.date_d_14.date_m_02 div#maincontent {
background-image: url(mushy_heart_background.gif);
}
That may be what I am looking for. I didn't know if it were possible. I would also need to test across several browsers.
The idea is to remove the need for date_dm_XX_XX, and replace it with a class that only becomes active when a single container has two classnames that correspond to the same date.