From the course: HTML: Tables

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Stripe table rows with background colors

Stripe table rows with background colors - HTML Tutorial

From the course: HTML: Tables

Start my 1-month free trial

Stripe table rows with background colors

- [Instructor] Our table looks pretty good as it is. I probably would leave it just like this if this was the only four products that I had in this particular table. But it's more than likely, and as you can tell, these are only A, B, and C products, it's more than likely that we're going to have at least dozens of rows, if not hundreds of rows. One of the things that we can do in order to make this table a little easier to read is to add a little bit of table striping. In other words, maybe every other row might be shaded in a certain color. And to do that, it's actually very straightforward. Once again, all we have to do is leverage another col selector. In this case, I only want to effect the tbody portion of this table, so I'm going to say my tbody and then the rows within it, I'm going to use the selector called nth-child. And nth-child will let you select something other than the very first child or the very last child. We can now select whichever children we want. In this case,…

Contents