Below is a sample HTML table that I created. And I would appreciate some advice on how to best style things so my CSS is clean.
First here is the code…
<table>
<!-- Column Groups -->
<colgroup>
<col id="feature">
<col id="guest">
<col id="basic">
<col id="premium">
<col id="premium+">
</colgroup>
<!-- Column Headings -->
<tr>
<th>Feature</th>
<th>Guest</th>
<th>Basic<br/>Access</th>
<th>Premium<br/>Access</th>
<th>Premium<br/>+ eBook</th>
</tr>
<!-- Rows -->
<tr>
<td>News</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Articles</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Opinion</td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Interviews</td>
<td>-</td>
<td>-</td>
<td>X</td>
<td>X</td>
</tr>
</table>
Questions:
1.) How do you name IDs and Classes?
someClass
some-class
some_class
someclass
something.else
2.) Should I give my table an ID/name so that all styles within built off of that unique name?
3.) How do I style my colgroup so that the “basic” column is one color, the “premium” column another color and so on?
4.) If I want the “feature” column left justified and all other columns centered, what is the best way to do that?
5.) What is the best way to adjust column widths?
6.) What is the best way to add borders (e.g. outside, columns, possibly cells, etc)?
Thanks.