Grow your CSS skills. Land your dream job.

[Solved] Div Problem For List Items

  • # March 5, 2010 at 1:26 pm

    I am working on the main navigation for an ecommerce site: http://216.122.61.35/ and I have this background property that is taking over my life – any help is greatly appreciated.

    On my main navigation list items i am using css gradients for the active property.

    Code:
    #nav li.level0 a:hover, a:active {
    color: #FFF;
    background: #8d0a0a;
    background: -moz-linear-gradient(top, #1e1e1e, #3d3d3d);
    background: -webkit-gradient(linear, left top, left bottom, from(#1e1e1e), to(#3d3d3d));}

    Problem is that this background gradient is applying to every link that is pressed on the site. I am not a CSS expert, so hopefully this is an easy fix for you folks.

    Thanks for the help!

    # March 5, 2010 at 5:40 pm

    Very easy fix.

    You need to make sure that you are selecting things properly!

    #nav li.level0 a:hover, a:active { }

    is NOT the same as

    #nav li.level0 a:hover, #nav li.level0 a:active { }

    See the difference?

    a:active = the entire site

    #nav li.level0 a:active = only your nave

    # March 5, 2010 at 6:48 pm

    TheDoc is right. You have to remember that commas separate entirely different targets. If you have a really long target, and you use a comma to separate it and another target, even if you’re only changing the end, you have to retype out the whole thing.

    # March 8, 2010 at 1:55 pm

    You guys freakin rock! :D

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".