Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not Cascading?

Status
Not open for further replies.

dillpick6

Programmer
Jun 5, 2003
11
US
Hello all,

I have a table made in php that has a row which the table is ordered by, and that row has a different color background. Here are the examples of the table and my CSS:

---Table---
<td>
entry 1
</td>
<td bgcolor=&quot;#ffffff&quot;>
entry 2
</td>

---CSS---
td {
background-color: #eeeeee ;
text-align: center ;
color: black ;
}

So the problem is that the backgroud color of entry 1 and 2 are both #eeeeee. From my impression the &quot;cascade&quot; is that of browser default, external style sheet, internal style sheet, then the code itself (this being the top of the heirarchy). Does anyone know why this might be happening?

To solve the problem I made a class that had just a backgroud of white (like td.white), but the example above should have worked from my understanding. I just thought we could all benefit from this if someone knows. Thanks a bucnh!

-Dave-
 
In order for yor table to look like you want, you'll need to create a &quot;class&quot; for your cells that are to be collored with #eeeeee.

---CSS---
td.odd {
background-color: #eeeeee ;
text-align: center ;
color: black ;
}

To use it, you'd do this:

<td class=&quot;odd&quot;>

Your class names can be whatever you like but they must be unique for each tag - td.odd and p.odd is ok.

There's always a better way. The fun is trying to find it!
 
for your example to work you should have do this:

<td>
entry 1
</td>
<td style=&quot;background: #ffffff;&quot;>
entry 2
</td>

as for normal attributes, css will always override those. but the hierarchy goes like that: external, internal, inline.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top