Blankman
Blankman

Reputation: 266940

Set border on first table row, w/o using a ID or class

I am trying to style a web app that we don't have the source code too.

So I drilled down into the DOM, but right now the bottom border is being set on ALL the rows, I need only the first row.

#tableID tbody tr td table tbody tr
{
  border-bottom: solid 1px #cccccc; 
}

Is this possible?

Upvotes: 0

Views: 898

Answers (2)

AxelEckenberger
AxelEckenberger

Reputation: 16926

#tableID tbody tr td table tbody tr:first-child { }

Should select the first chidld according to the CSS 2 selector specification.

See here for some information which browsers select the selectors.

Upvotes: 1

Barry
Barry

Reputation: 2063

If you don't care about supporting IE6:

#tableID tbody tr td table tbody:first-child
{
  border-bottom: solid 1px #cccccc;
}

Upvotes: 1

Related Questions