SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict limepickle's Avatar
    Join Date
    Jan 2006
    Location
    Aldridge UK
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Apply style to first <li> in <ul>

    I have an <ul> with inline <li> tags that have a bg image to simulate a bullet image. However I want the first and fourth <li> tags to NOT have a bg image.

    I've tried applying a class to the desired <li>'s eg:

    .no-bg {
    background-image: none;
    }

    but it doesn't work. Does anyone know how to do this? Thanks!

  2. #2
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,122
    Mentioned
    29 Post(s)
    Tagged
    2 Thread(s)
    Hello,

    I think it's to do with the level of specificity.
    For example if you have #menu li { background: xxx } above then the class selector .no-bg is less specific and will not overide the original style.
    You would need to have something like #menu li.no-bg

  3. #3
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can do such things like

    .nav li.convertinglink a:hover
    {
    styles
    }

    dont forget that browsers can be forgiving in some instances. This works for things such as setting classes for links for navigation. Making the hover colours different for your lists and so forth.

  4. #4
    SitePoint Addict limepickle's Avatar
    Join Date
    Jan 2006
    Location
    Aldridge UK
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks mark & sp111

    much appreciated.


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
  •