[thelist] css: background-color
Gary Bland
Gary at star-chaser.com
Tue Oct 1 09:57:06 CDT 2002
Joxn wrote:
> Hi folks,
> I output a list in alternating background colors per row. The first one
> has a white background, the second a grey background and the third a
> white one again.
>
> I used to do this by simply setting either <tr bgcolor="white"> or <tr
> bgcolor="grey"> after checking with PHP which row I am in.
>
> Well, since switching to CSS I can't seem to get it right.
>
> I tried the following:
>
> tr1
> {
> background-color : #FFFFFF;
> }
> tr2
> {
> background-color : #DCDCDC;
> }
>
> However, as I understand the CSS spec, the background-color is not
> automatically inherited.
>
> Then I added the following class to the <td> elements:
> td.content
> {
> background-color : inherit;
> }
>
> But with no luck...
>
> Is there an easy way with CSS to create the same result as before? Am I
> overlooking something?
Your missing the dots to make it a class.
.tr1{
background-color:#FFFFFF;
}
.tr2{
background-color:#DCDCDC;
}
in the tr
<tr class=tr1">
HTH
Gary
--
Gary Bland
StarChaser Web Architecture
http://star-chaser.com
Building Tomorrow's World Today
More information about the thelist
mailing list