4 replies [Last post]
forum Guy
Offline
newbie
Last seen: 15 years 46 weeks ago
Joined: 2003-11-03
Posts: 10
Points: 0

I have the following code:
<table>
<div class="std1">
<tr>
<td>First</td>
<td><input type="text" disabled="true" value="" /></td>
<td>Last</td>
<td><input type="text" disabled="true" value="" /></td>
</tr>
</div>
</table>
I am trying to style, I would like to target or select the TD tags within the DIV of class std1, I have tried the following and it does not work:
div.std1 TD{
font-family:arial, sans-serif;
color:black;
font-size:8pt;
font-weight: normal;
}
A table layout is extremely important because the page contains dynamic content.
Thanks,
FI

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 2 days 2 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

How to control Td of a specified TR

Hi forum Guy,
I don't think you can use a div inside a table around a tr, it shouldn't be valid markup.
Why not remove the div and give the class name to the tr or table.

<table> 
<tr class="std1"> 
<td>First</td> 
<td><input type="text" disabled="true" value="" /></td> 
<td>Last</td> 
<td><input type="text" disabled="true" value="" /></td> 
</tr> 
</table> 

Hope that helps

forum Guy
Offline
newbie
Last seen: 15 years 46 weeks ago
Joined: 2003-11-03
Posts: 10
Points: 0

How to control Td of a specified TR

Thanks for the reply Tony, excellent suggestion and it works, is there anywhere (I have read and used so many tutorials) that explains these rules and why what I was attempting to do is not rendered properly by the style engine.
Thanks,
FI

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 2 days 2 hours ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

How to control Td of a specified TR

Hi forum Guy,
I'm not sure if there is any specific article that would help.
Browsers can be very forgiving and let developers get away with a lot of stuff that isn't valid. Best thing I can suggest is to keep validating Markup and CSS as you develop and learn from your mistakes.

Sites like http://hotwired.lycos.com/webmonkey/ and http://www.w3schools.com/ would be good sites to look for articles.

Hope that helps.

forum Guy
Offline
newbie
Last seen: 15 years 46 weeks ago
Joined: 2003-11-03
Posts: 10
Points: 0

How to control Td of a specified TR

Great advise.
Thanks,
FI