Results 1 to 3 of 3

Thread: [menu] individual style element (on hover)

  1. #1
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default [menu] individual style element (on hover)

    Hello,

    sorry i know the title is far from clear

    here's the deal :
    i played a little with the Chrome CSS Drop Down Menu but i can't figure out a way to apply different styles to each element.

    i'd like the bg image/color (on mouse hover) to be different on each menu element. like green when the mouse is on resources, blue when it's on News, yellow on search etc..

    thank you very much

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Hi...

    The hover styles are set with this piece of CSS code:

    Code:
    .chromestyle ul li a:hover{
    background: url(chromebg-over.gif) center center repeat-x; /*THEME CHANGE HERE*/
    }
    To customize it per element you can use a CSS class selector and define the individual backgrounds in the CSS.

    You should have something like this currently:
    Code:
    <div class="chromestyle" id="chromemenu">
    <ul>
    <li><a href="http://www.dynamicdrive.com">Home</a></li>
    <li><a href="#" rel="dropmenu1">Resources</a></li>
    <li><a href="#" rel="dropmenu2">News</a></li>
    </ul>
    </div>
    If you add some classes (highlighted) it will look like this:
    Code:
    <div class="chromestyle" id="chromemenu">
    <ul>
    <li><a class="home" href="http://www.dynamicdrive.com">Home</a></li>
    <li><a class="resources" href="#" rel="dropmenu1">Resources</a></li>
    <li><a class="news" href="#" rel="dropmenu2">News</a></li>
    </ul>
    </div>
    Now, in the CSS you can set styles specific to those elements like so:

    Code:
    .chromestyle ul li a.resources:hover{
    background: url(chromebg-over.gif) center center repeat-x;
    You would, of course, repeat for the other class names (news, home, etc...).

    Hope that helps

  3. #3
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    perfect !

    i was actually copying/pasting the whole chromestyle class, renaming it and changing colors and everything i needed

    and i was applying the modified classes to the <li> not <a>

    anyway, thank you very much for your help !

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
  •