|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm trying to use selectors and CSS inheritance to define the width of a DIV element (or the TD itself) of the very first TD in every table row. I have the following:
TABLE.list TR TD:first-child DIV { width:50%; } This does nothing (neither in IE6 nor NN6). Can anyone offer a solution? Thanks, N8. |
|
#2
|
|||
|
|||
|
Try doing it inside Dreamweaver ... might be easier
|
|
#3
|
|||
|
|||
|
I believe you'd need to use 'first-child' like this:
TABLE.list TR TD:first-child {....} Irrelevent, anyway, except for NS6-intra as this pseudo-class isn't supported yet for MSIE. I think. Classes might do it: Code:
<html>
<head>
<title>untitled</title>
<style type="text/css">
body {
text-align: center;
}
table {
width: 80%;
border: 3px darkred double;
}
td {
height: 100px;
background: black;
}
td.first {
width: 50%;
height: 100px;
font: 200 18px monospace;
padding-left: 3px;
background: tomato;
}
</style>
</head>
<body>
<table>
<tr>
<td class="first">class="first"</td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td class="first">class="first"</td><td></td><td></td><td></td><td></td><td></td>
</tr>
</table>
</body>
</html>
http://www.blooberry.com/indexdot/c...sfirstchild.htm |
|
#4
|
|||
|
|||
|
If you're going to use the inefficient " " selected instead of the ">" selector, might as well go:
table.list td:first-child div I'd personally go like: table.list > tbody > tr > td:first-child > div Because the > has better performance than " " (only searches one level down), though IE of course being the crappy browser that it is does not support >. ![]() NS6, NS7, Galeon, K-meleon, Beonex, and anything Mozilla-based all do, as well as Opera 6 and probably the latest Konqueror. But naturally IE doesn't. ![]() |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > CSS/IE6: Setting width of DIV inside first TD of table rows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|