Results 1 to 3 of 3

Thread: Interpreting nth-of-type

  1. #1
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default Interpreting nth-of-type

    Hi, you guys. I've been messing around with using javascript to find elements based on CSS for a couple weeks now(to learn a little JS and CSS). You can see my progress here.Here's my question. Given the following HTML and CSS statement, what exactly is matched?
    Code:
    div > *:nth-of-type(1)
    Code:
    <div>
    <div>Test tag</div>
    <p>Test paragraph</p>
    </div>
    Will both tags be matched because they are both the first of their type, or will just the div match because the given tag is a wildcard? Hope you can help.

    PS: Just for reference - http://www.w3.org/TR/2001/CR-css3-se...of-type-pseudo
    Last edited by blm126; 05-18-2007 at 01:51 AM. Reason: I need to learn to proofread

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Both will be matched. There's no reason to match only the <div>.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Thanks Twey. That was what I was thinking, but the specs are very vague on this point.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •