课程: HTML: Tables

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Stripe table rows with background colors

Stripe table rows with background colors - HTML教程

课程: HTML: Tables

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,…

内容