SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is this just a regular descendant selector?

    Hi,

    I just read through a style sheet and came across this:

    HTML Code:
    .class1.class2 .class3 {}
    (pay attention to the space between .class2 and .class3)

    Does that mean "select each object with attribute "class 3" which is a direct descendant of an object with both attributes "class1 and class2" "?

    thx
    AO

  2. #2
    Community Advisor silver trophybronze trophy
    dresden_phoenix's Avatar
    Join Date
    Jun 2008
    Location
    Madison, WI
    Posts
    2,805
    Mentioned
    34 Post(s)
    Tagged
    2 Thread(s)
    Yes, this targets any element that that is a descendant of any other element that has both class1 and class2.

    For example:
    Code:
    <div class="class1 class2">
      <p> text</p>
       <div>
         <p class="3">it would target me</p>
         <p>text</p>
    </div>
         <p class="3">it would target me</p>
    </div>
         <p class="3">text</p>
    VERY OLD version of IE did not support class chaining like this.. but these days it's hardly an issue.

  3. #3
    SitePoint Member
    Join Date
    Feb 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok I got it!

    Thank you very much.
    AO


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
  •