SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Baffled regarding selector not working

    Buongiorno from 2 degrees C occasionall snowing wetherby :-)

    On this page http://tutorial.davidclick.com/2menu.html & illustrated here http://i216.photobucket.com/albums/c...ps6022034b.jpg i've been working with positioning the logo of the dog absolutely just as an exercise to get familiar with how it works and interacts with other elements.

    Specifically I need this piced of html:

    <div id="header">
    <h1>The quick brown fox jumps over the lazy dog</h1>
    <img class="fox" src="fox.JPG">

    to talk to this bit of CSS:

    {
    position:absolute;
    left:200px;
    top:10px;
    }

    Originally i placed this selector which i thought in the rules of inheritance would be correct:
    #header .fox
    {
    position:absolute;
    left:200px;
    top:10px;
    }

    But this was wrong, what worked was:

    .fox
    {
    position:absolute;
    left:200px;
    top:10px;
    }

    So my question is please:
    "Why did the selector #header.fox not work & .fox did?"

    Any insights welcome,
    David
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com

  2. #2
    SitePoint Mentor bronze trophy
    ronpat's Avatar
    Join Date
    Jun 2012
    Location
    NJ, USA
    Posts
    2,457
    Mentioned
    61 Post(s)
    Tagged
    2 Thread(s)
    You may have given away the answer to the question in your message. In your message, you describe the following three (3) ways of addressing the selector. The bottom one does not work in your HTML. The first two work fine. (Note the absence of a space between the id and class in the last example.)

    Code:
    .fox {...}
    
    #header .fox {...}
    
    #header.fox {...}
    does this help?

  3. #3
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Ronpat, damn gap now i see! Thank you :-)
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com

  4. #4
    SitePoint Mentor bronze trophy
    ronpat's Avatar
    Join Date
    Jun 2012
    Location
    NJ, USA
    Posts
    2,457
    Mentioned
    61 Post(s)
    Tagged
    2 Thread(s)
    Cool. We're always "up" for a challenge!

    Cheers!


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
  •