Zebra table using only CSS3
tr:nth-child(2n+1){ background: #fff }
tr:nth-child(2n+0){ background: #ffffec }
Written by Andréia Bohner
Related protips
2 Responses
I believe you can also use :nth-chilld(even)
and :nth-child(odd)
. :)
over 1 year ago
·
You don't need two nth-child
selectors, just give the default style to the original tr
element. If you want to do every other row starting with the second, 2n
or even
is sufficient.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#