clarkk clarkk - 1 year ago 83
CSS Question

How to select first and last TD in a row?

How can you select the first and the last

in a row?

tr > td[0],
tr > td[-1] {
/* styles */

Answer Source

You could use the :first-child and :last-child pseudo-selectors:

tr td:first-child,
tr td:last-child {
    /* styles */

This should work in all major browsers, but IE7 has some problems when elements are added dynamically (and it won't work in IE6).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download