![]() |
You can combine the styling from the two examples above and you will have stripes on every other row and every other column. If you use a transparent color you will get an overlapping effect. |
Example:
HTML
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
tr:nth-child(even) {
background-color: rgba(150, 212, 212, 0.4);
}
th:nth-child(even),td:nth-child(even) {
background-color: rgba(150, 212, 212, 0.4);
}
</style>
</head>
<body>
<h2>Striped Table</h2>
<p>For zebra-striped tables, use the nth-child() selector and add a background-color to all even (or odd) table rows:</p>
<table style="width:100%">
<tr>
<th>MON</th>
<th>TUE</th>
<th>WED</th>
<th>THU</th>
<th>FRI</th>
<th>SAT</th>
<th>SUN</th>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
What is HTML Table Styling | HTML Table Styling |
How to create HTML Table - Zebra Stripes | HTML Table Styling |
How to create HTML Table - Vertical Zebra Stripes | HTML Table Styling |
How to create HTML Table Combine Vertical and Horizontal Zebra Stripes | HTML Table Styling |
How to create HTML Table Horizontal Dividers | HTML Table Styling |
How to create HTML Hoverable Table | HTML Table Styling |
Full Example of Combine Vertical and Horizontal Zebra Stripes | HTML Table Styling |
Read Full: | HTML Table Styling |
Category: | Web Tutorial |
Sub Category: | HTML Table Styling |
Uploaded by: | Admin |
Views: | 75 |
Reffered: https://www.w3schools.com