SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot theslip's Avatar
    Join Date
    Jun 2008
    Location
    here
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question real quick one pls

    #adiv .Item p {
    }

    would this select all paragraphs inside a div with a class of '.Item' only in a div with an ID of 'adiv'

    Is this ok?

    cheers

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,281
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    It would select paragraphs that were contained within an element having a class of Item which itself was inside an element that had an id of adiv. Whether those elements are divs or not is not defined.

    It would select this item as follows:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    #adiv .Item p {
        background:red;
    }
    </style>
    </head>
    <body>
    <div id="adiv">
        <div class="Item">
            <h2>This isn't red</h2>
            <p>this is red</p>
        </div>
        <p>This isn't red</p>
    </div>
    </body>
    </html>
    Last edited by Paul O'B; Feb 19, 2010 at 07:01.

  3. #3
    SitePoint Zealot theslip's Avatar
    Join Date
    Jun 2008
    Location
    here
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    perfect cheers dude, your the man

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Paul O'B View Post
    It would select paragraphs that were contained within an element having a class of .Item which itself was inside an element that had an id of #adiv.
    Tsk tsk.

    That should be '... inside an element that had an id of adiv' (not '#adiv').

    You really think that Paul would know these things after all those years. I guess it's evidence of the onset of old age ...

    Birnam wood is come to Dunsinane

  5. #5
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,281
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    Tsk tsk.

    You really think that Paul would know these things after all those years. I guess it's evidence of the onset of old age ...

    Your time will come


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
  •