Jump to content

How to style even and odd rows


newcoder1010
 Share

Recommended Posts

Hello,

My site does not have even and odd classes for rows in table. I am having problem giving odd and even classes. I like to know how I can style odd and even rows when <tr> do not have any classes?

<table class="table">
<thead>
<tr>
<th id="view-field-address1-table-column" class="views-field views-field-field-address1" scope="col">Address</th>
<th id="view-field-f-table-column" class="views-field views-field-field-f" scope="col">First Name</th>
</tr>
</thead>
<tbody>
<tr><td headers="view-field-address1-table-column" class="views-field views-field-field-address1"> </td> <td headers="view-field-address1-table-column" class="views-field views-field-field-address1"> </td></tr>
<tr><td headers="view-field-address1-table-column" class="views-field views-field-field-address1"> </td> <td headers="view-field-address1-table-column" class="views-field views-field-field-address1"> </td> </tr>
</tbody>
</table>

Please advise!

Link to comment
Share on other sites

  • 6 months later...

Hello,

You can use a striped table to style even and odd rows. After giving this property, you can hide the border of the table so that it won't look like a table, but like a regular element. Here is a reference link for further research.

https://css-tricks.com/snippets/css/css3-zebra-striping-a-table/

 

I hope, this clarifies your doubts. Have a nice day. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...