SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast irishstu's Avatar
    Join Date
    Aug 2003
    Location
    Dublin Ireland
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    div id list images overriding div class list images

    i have a div whose id is "content", and in this i'm putting in images for bullets onto list items. Within this div, i have other divs (using the class attribute), and i want put list items with no bullets in these. IE seems to have a problem with this and is putting images onto the lists sometimes (comes & goes on refresh)

    so basically:

    <div id="content">

    <div class="info">
    <ul class="plist">
    <li>blah</li>
    <li>blah</li>
    <li>blah</li>
    </div>

    and in the css:

    #content ul li { list-style-image: url(../img/list_arrow.gif); }
    ul.plist li { list-style-image: none; }

    i've tried assigning blank images to the ul.plist li but it didn't work. Any ideas?

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,467
    Mentioned
    182 Post(s)
    Tagged
    6 Thread(s)
    Just a thought as I can't test this without seeing your cose but Id's carry more weight than classes so your #content ul li is very specific and may override the ul.plist li .

    Try changing the content id to a class instead.

    If that doesn't help shout and I'll do some proper testing

    Paul

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    How about getting so specific that IE can't screw it up?*
    Code:
    #content ul.plist li {
      list-style: none;
    }

    *It can screw up all it wants, but we can hope right?

  4. #4
    SitePoint Enthusiast irishstu's Avatar
    Join Date
    Aug 2003
    Location
    Dublin Ireland
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Paul - that was my last resort but seeing as content was unique i wanted it to be an id - and thanks for the offer

    vgarcia - bang on... you're a lifesaver!

    (stupid IE!)

  5. #5
    SitePoint Zealot Octal's Avatar
    Join Date
    Feb 2003
    Location
    UK
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Paul is right, ID selectors have precedence over Class selectors. Which is defined in the css2 spec I believe?

    As stated in Sitepoint's book on CSS:
    The ID selector permits you to identify single instances of HTML elements where you wish to override the style properties set in, for example, a class style rule.
    So in this example it seems IE is (almost) right!!

    Edit: You may want to re-organise the code for the list elements or maybe create a new selector for the special case altogether. Sorry it's a bit difficult to explain without seeing your code.
    Octal - All your base-8 belong to us
    "Knowing is not enough, we must apply.
    Willing is not enough, we must do." - Bruce Lee

  6. #6
    SitePoint Zealot Hulkur's Avatar
    Join Date
    Oct 2001
    Location
    Estonia
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    good practice is to define general rules (class) before unique rules (id)
    this way class rules are overriden by id rules which come later in the file

    just a thought
    (2B) or (not 2B) = FF


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
  •