CSS Horizontal Menu - intermidate question

Discussion in 'CSS' started by le007, Sep 20, 2007.

  1. #1
    Hi crazy cats,
    its very late, I'm very tired and I have the answer to this question somewhere (I think in 1 of my folders). Spent 5 mins looking for it but cant find it so maybe by posting it'll help someone else out in the future!

    Ok, no worries doing a horizontal css dropdown...

    How about 1 that changes individual colour of each <li> background?
    You know, eg: forum jumps bg would be green, user cp's yellow, fun stuff's red etc.

    Whats the easiest/best way to do this without setting a specific class to each <LI>

    Thanks,
    Leo
     
    le007, Sep 20, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    CSS3 :D How about XSLT? :p

    Seriously though, there is no way with what you have available apart from using a class for each one.
     
    krt, Sep 20, 2007 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Adjacent selectors should do the trick nicely.

    li { color:red; }
    li+li { color:blue; }
    li+li+li { color:green; }

    etc, etc, etc.

    Doesn't work in IE 6.x or earlier though. Works in FF, Opera, Safari AND IE7 - but no 6.
     
    deathshadow, Sep 21, 2007 IP
  4. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    I forgot to mention that when hovered they turn a different colour too.... its a separate class issue, right?
     
    le007, Sep 21, 2007 IP
  5. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Well you could do li+li:hover but IE6 and under doesn't allow li:hover. Not to mention it still uses adjacent selectors which IE6 also does not support.
     
    krt, Sep 21, 2007 IP
  6. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #6
    Yeah I kinda need it to be IE/FF compliant. Ok, guess its different classes, thanks guys
     
    le007, Sep 22, 2007 IP