The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Programming Fundamentals" Dec 02 - 2:00 PM Eastern

Even & Odd Table Row Colours

  • # April 21, 2009 at 10:34 pm

    I was hoping someone might have a solution to creating Even and Odd background colours to table rows. The data would be coming from a database. I was hoping for an all CSS solution, but am really open to anything. I read something about tr:nth-child but it doesn’t seem to work in IE.

    Any help would be greatly appreciated.

    # April 22, 2009 at 2:47 am

    its hard to tell it that way you have to send your table structure which you want to fetch from database

    # April 22, 2009 at 9:05 am

    This reply has been reported for inappropriate content.

    This looks like it’s just what you wanted…

    # April 22, 2009 at 9:34 am

    thank you all. I’m going to give these suggestions a try.

    Take Care

    # April 22, 2009 at 12:49 pm

    Yeah it’s trivially easy with something like jQuery…

    You can use a selector like $("td:odd")



    Then apply styling for the odd rows in your CSS.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed