Selecting the first a tag in a div with CSS

is it possible to select the first a tag in a div? Which browsers would it work on?

<a href=“link”>Link</a>some text going on here <a href=“link”>Link</a>

I want to do something only to the first link within the div (note I’m working in somewhat of a restricted system so I can’t change the HTML so I can’t add a class or id to it.

OK, you do it like this:

div a:first-child {
  [I]styles here[/I]

More info here:

Just be warned, first-child doesn’t work in IE6 at all and is buggy as sin in IE7 – so you may want to use a class to do that.

Yeah, I didn’t bother pointing this out because I’m tired of it. first-child is the only solution I can think of, given Jordash doesn’t have access to the HTML.

Do you mean the first element? Yes, for sure. Could you give an example?