tags:

views:

60

answers:

6

how i can select all tr except first tr in the table using css.

how i can select them using css

i used this method and find that first child not worked

http://www.daniel-lemire.com/blog/archives/2008/08/22/how-to-select-even-or-odd-rows-in-a-table-using-css-3/

+3  A: 

By adding a class to either the first tr or the subsequent trs. There is no crossbrowser way of selecting the rows you want with CSS alone.

However, if you don't care about Internet Explorer 6, 7 or 8:

tr:not(:first-child) {
    color: red;
}
Magnar
+1 exactly what I was going to write. However, only the second way is going to work, seeing as `:not` is not supported by IE < 9
Pekka
+2  A: 

ideal solution but not supported in IE

tr:not(:first-child) {css}

second solution would be to style all tr's and then override with css for first-child:

tr {css} tr:first-child {override css above}

FutureKode
CSS3 selectors for IE - http://selectivizr.com/
Badr Hari
A: 

You could create a class and use the class when you define all of your future 's that you want (or don't want) to be selected by the CSS.

This would be done by writing

<tr class="unselected">

and then in your css having the lines (and using the text-align command as an example) :

unselected {
  text-align:center;
}



selected {
  text-align:right;
}
+1  A: 

sounds like the 'first line' you're talking of is your table-header - so you realy should think of using thead and tbody in your markup (click here) which would result in 'better' markup (semantically correct, useful for things like screenreaders) and easier, cross-browser-friendly possibilitys for css-selection (table thead ... { ... })

oezi
A: 

Since "tr:not(:first-child)" is not supported by IE 6, 7, 8. You can use the help of jQuery. You may find it here

Thanks

DangerBoss