Horje
How to create HTML Table - Vertical Zebra Stripes | HTML Table Styling Code
How to create HTML Table - Vertical Zebra Stripes

To make vertical zebra stripes, style every other column, instead of every other row.

 


Full Example of HTML Table - Vertical Zebra Stripes

Set the :nth-child(even) for table data elements like this:
index.html
Example: HTML
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}

th:nth-child(even),td:nth-child(even) {
  background-color: #D6EEEE;
}
</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>

Output should be:

Full Example of HTML Table - Vertical Zebra Stripes



Read Full::
HTML Table Styling Code
Category:
HTML Code
Sub Category:
HTML Table Styling Code
Uploaded:
10 months ago
Uploaded by:
Admin
Views:
1

Related Articles
What is HTML Table Styling HTML Table Styling Code
How to create HTML Table - Zebra Stripes HTML Table Styling Code
How to create HTML Table - Vertical Zebra Stripes HTML Table Styling Code
How to create HTML Table Combine Vertical and Horizontal Zebra Stripes HTML Table Styling Code
How to create HTML Table Horizontal Dividers HTML Table Styling Code
How to create HTML Hoverable Table HTML Table Styling Code

Single Articles
Full Example of HTML Table - Vertical Zebra Stripes

Share on: