PDA

View Full Version : TR CSS Style not working



azstyx
Nov 28th, 2006, 09:43 PM
Hello folks,
I have a CSS definition for a Table Row that does not seem to be working.
The TR background color (light blue) is correct.
A-link in a TD cell is displayed correctly. (white text with underline)
Plain text in a TD cell is not displaying correctly, it shows text color gray #666666 when the text should be white. Looks like it is using the CSS definition for TD.
My CSS code:


td a:link {color:#666666; text-decoration: underline;}
td a:visited {color:#666666;}
td a:hover {text-decoration: underline; }
td a:active {color:#666666;}

th {
font-family:Verdana, Arial, Helvetica;
font-size:12px;
font-weight: bold;
color:#333333;
background-color:#999999;
text-align: center; }

td {
font-family:Verdana, Arial, Helvetica;
font-size:12px;
color:#666666; }

tr.fl {
font-family:Verdana, Arial, Helvetica;
font-size:12px;
color:#ffffff;
background-color:#336699;
}
tr.fl a:link {color:#ffffff; text-decoration: underline;}
tr.fl a:visited {color:#ffffff;}
tr.fl a:hover {text-decoration: underline; }
tr.fl a:active {color:#ffffff;}


MY HTML page source:


<table width="900" border="0" cellpadding="0" cellspacing="0">
<tr><th>Object Name</th><th>Type</th><th>FileSize(KB)</th><th>Last Mod</th><th width="500">Description</th></tr>
<tr class="fl">
<td><a href=/cgi-bin/repshake.cgi?d=TEST01>TEST01/a></td><td>DIR</td>
<td>0.50</td><td>Tue Nov 28 14:39:30 2006</td>
<td>a test dir by keith</td>
</tr>

VIPStephan
Nov 28th, 2006, 09:50 PM
Table rows (tr) can't be styled as other elements (e.g. table cells (td)), meaning they don't react on every kind of styling. Why don't you just write:


tr.fl td{
font-family:Verdana, Arial, Helvetica;
font-size:12px;
color:#ffffff;
background-color:#336699;
}

...since the stuff you are styling is in table cells anyway?

azstyx
Nov 28th, 2006, 09:57 PM
THANK YOU VERY MUCH!!!!
:)
This worked perfectly, just learned something more about CSS!
Cool beans!