Results 1 to 6 of 6

Thread: Popup image viewer - class questions

  1. #1
    Join Date
    Mar 2008
    Location
    Fremont. CA
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Popup image viewer - class questions

    1) Script Title:
    CSS Popup Image Viewer

    2) Script URL (on DD): http://www.dynamicdrive.com/style/cs...-image-viewer/

    3) Describe problem:
    Having only rudimentary knowledge of CSS I wondered why some of the class definition have more than one term before the brackets. For instance
    ".thumbnail span{..."
    ".thumbnail span img{..."
    ".thumbnail:hover span{..."

    I understand the addition of the pseudo class ":hover" but why are the other terms used?
    I did some searching around and couldn't find an explanation.

    Hopefully someone could provide an explanation or point me to a location where I could find a description.

    Thx

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    I'm not good at explaining things, not unless you'll be satisfied
    .thumbnail span
    This means that an element having a class thumbnail, we will specify the element that has the span tag, and have some CSS declaration
    .thumbnail span img
    This means that an element having a class thumbnail, we will specify the element that has the img tag inside the span tag, and have some CSS declaration.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Mar 2008
    Location
    Fremont. CA
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by rangana View Post
    I'm not good at explaining things, not unless you'll be satisfied

    This means that an element having a class thumbnail, we will specify the element that has the span tag, and have some CSS declaration

    This means that an element having a class thumbnail, we will specify the element that has the img tag inside the span tag, and have some CSS declaration.
    Thanks for your response.

    One additional question if I may:

    Does this only apply to the "span" tag because of its unique nature or are there other tags that could be used this way. For instance could I write something like:
    ".someclassname h1{....}"
    This is a nonsense example but I'm just trying to understand how wide spread this approach could be.

    Thanks again, I appreciate the help.
    RB

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    It's easier just to explain all of this using its technical term, which is CSS Specificity. Take a look at the below link for example for more info:

    http://www.htmldog.com/guides/cssadvanced/specificity/

  5. #5
    Join Date
    Mar 2008
    Posts
    12
    Thanks
    0
    Thanked 5 Times in 4 Posts

    Default

    Quote Originally Posted by dorichcss View Post
    For instance could I write something like:
    ".someclassname h1{....}"
    This would mean that you have a parent element with a class name of "someclassname" which contains an element with the "h1" tag. The whole CSS rule would select the very heading within an element of the "someclassname" class name.

    Possible scenarios:
    HTML Code:
    <div class="someclassname">
        <h1>My Heading</h1>
    </div>
    HTML Code:
    <body class="someclassname">
        <h1>Main Heading</h1>
    ...
    </body>
    Your CSS code would select the <h1> element in each of the above scenarios in order to define some style rules for it.

    Hope this helps.

    Felix Riesterer.

  6. The Following User Says Thank You to Felix Riesterer For This Useful Post:

    dorichcss (03-25-2008)

  7. #6
    Join Date
    Mar 2008
    Location
    Fremont. CA
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Felix Riesterer View Post
    This would mean that you have a parent element with a class name of "someclassname" which contains an element with the "h1" tag. The whole CSS rule would select the very heading within an element of the "someclassname" class name.

    Possible scenarios:
    HTML Code:
    <div class="someclassname">
        <h1>My Heading</h1>
    </div>
    HTML Code:
    <body class="someclassname">
        <h1>Main Heading</h1>
    ...
    </body>
    Your CSS code would select the <h1> element in each of the above scenarios in order to define some style rules for it.

    Hope this helps.

    Felix Riesterer.
    Thanks that confirms my understanding.

    I appreciate the help.

    RB

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
  •