Forum Moderators: not2easy
BODY {
font: 8pt sans-serif;
}
TABLE {
border-collapse: collapse;
}
TD {
font: 8pt sans-serif;
color: #737173;
font-weight: bold;
text-align: center;
}
I need the first "TD" to do what is listed above and another "TD" to do other things. i.e. "text-align: left"
Thanks
With CSS there are multiple "selectors" (ways to address different HTML elements). The selectors you are using (just the element name) are element selectors, they apply to all of the named elements on the page. So TD {} applies to all <TD> elements on the page. You want a more specific selector like a class selector .td {} or an ID selector #td {}.
To use a class / class selector:
.td1 {
font: 8pt sans-serif;
color: #737173;
font-weight: bold;
text-align: center;
}
.td2 {
font: 8pt sans-serif;
color: green;
font-weight: normal;
text-align: right;
}
...
<TD class="td1">
...
<TD class="td2"> To use id / id selector:
#td1 {
font: 8pt sans-serif;
color: #737173;
font-weight: bold;
text-align: center;
}
#td2 {
font: 8pt sans-serif;
color: green;
font-weight: normal;
text-align: right;
}
...
<TD id="td1">
...
<TD id="td2"> And here is a full list of selector with examples:
[w3.org...]
Jordan
So in MSIE, the rules:
col.one {
font: 8pt sans-serif;
color: #737173;
font-weight: bold;
text-align: center;
background: #FFF;
}
col.two {
font: 8pt sans-serif;
color: green;
font-weight: normal;
text-align: right;
} will work with the following html:
<table summary="col style example">
<col class="one" />
<col class="two" />
<tbody>
<tr>
<td>Row one</td>
<td>Row two</td>
</tr>
</tbody>
</table>
This doesn't work [mail-archive.com] at all in Mozilla though and probably won't any time soon since it isn't part of the CSS 2.1 working draft. So I wouldn't count on it.