CSS selector for the last occurrence of a class on a page

Posted by snaken on Stack Overflow See other posts from Stack Overflow or by snaken
Published on 2010-05-12T20:41:02Z Indexed on 2010/05/12 20:44 UTC
Read the original article Hit count: 358

Filed under:
|
|

Is there a CSS selector for the last occurrence of a class on a page?

Say i have this HTML

<dd>
    <span>
        <a class="required" id="forename">foo</a>
    </span>
</dd>
<dd>
    <span>
        <a class="required" id="surname">bar</a>
    </span>
</dd>

Is there a CSS selector that would return the a tag with the ID of surname. Something like .required:last maybe?

Will be using Prototype if that matters?

© Stack Overflow or respective owner

Related posts about css-selectors

Related posts about css