adding css to certains rows of a html table

I have a html table called Table 1

#Table1 td {     border: 1px solid #0000ff; }

That css says color the border of every column in the table.

How would i do the following?

Color the border of every column in Table 1 that is not in row 1
Color the border this color #0000ff
LVL 1
maqskywalkerAsked:
Who is Participating?
 
Russ SuterConnect With a Mentor Commented:
Put this in your CSS
#table1 tr:nth-child(n+2) td
{
   border: 1px solid #0000ff;
}

Open in new window

This will set the border of any <td> element inside any <tr> element that is the 2nd or greater child of the <table id="table1"> element.
It will ignore the 1st row and no other CSS is needed to format your table this way.
Here's a handy website that gives you a fairly thorough set of examples of what the nth-child CSS selector can do: http://nthmaster.com/
0
 
Thomas WheelerCommented:
you want to use
tr > td:first-child 

Open in new window

check this out https://jsfiddle.net/wgrk1xpf/
0
 
Thomas WheelerConnect With a Mentor Commented:
after rereading I may have miss understood. Here is an update
https://jsfiddle.net/wgrk1xpf/1/
0
 
maqskywalkerAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.