Is there a way I can use one category to stylize all of my table cells? I cant just use
td{
}
because I have another table on the same page that I don't want the same style on. The table I want to stylize has around 40 cells, so is there a way to collectively style them short of copy-pasting a class or id 40 times?
In general, try to use TABLE for true tables of data, use DIV and SPAN for logical block or inline containers of content. Show activity on this post. Tables should only be used to display data in a tabular way. For layout and design it is best practise to use divs and stylesheets.
CSS provides a number of attributes for styling tables. These attributes allow you to—among other things—separate cells in a table, specify table borders, and specify the width and height of a table. This tutorial will discuss, with examples, how to style a table using CSS.
Put a selector on the table tag:
<table class="my-special-table">
<tr><td></td></tr>
</table>
table.my-special-table td { style it up! }
If your table has a specific attribute such an as ID, you can reference it in CSS specifically:
<table id="myStyledTable">
<tr>
<td>...
Like so:
#myStyledTable td {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With