Prelims - CSS tables Flashcards
property sets whether the table borders should be collapsed into a single border:
border-collapse
table { border-collapse: collapse; }
property sets the horizontal alignment (like left, right, or center) of the content in <th> or <td>
text-align
To center-align the content of <td> elements as well, use
text-align: center
To left-align the content, force the alignment of <th> elements to be left-aligned, with the
text-align: left
property sets the vertical alignment (like top, bottom, or middle) of the content in <th> or <td>
vertical-align
To control the space between the border and the content in a table, use the
padding
Use the____ selector on <tr> to highlight table rows on mouse hover:
:hover
tr:hover {background-color: coral;}
For zebra-striped tables, use the ____ selector and add a background-color to all even (or odd) table rows
nth-child()
tr:nth-child(even) {background-color: #f2f2f2;}