Grow your CSS skills. Land your dream job.

DIV background color remains white even when style says differently

  • # April 17, 2013 at 9:33 am

    I’m just learning CSS right now, and when I use the a:link a:visited a:hover tag, the color won’t change even if I change the code.. it’s weird.

    #navigation
    {
    float:right;
    height:48px;
    width:540px;
    background-color:#062134;
    margin-right:11.5%;
    margin-top:2.69%;
    }

    ul
    {
    padding:0;
    list-style:none;
    }

    li
    {
    width:85px;
    height:48px;
    float:left;
    font-family: Arial, Helvetica, sans-serif;
    text-align:center;
    }

    #navigation a:link, a:visited
    {
    display:block;
    height:33px;
    background-color:#062134;
    color:#fff;
    text-decoration:none;
    font-family:Arial, Helvetica, sans-serif;
    font-size:16px;
    font-weight:light;
    padding-top:15px;
    }

    #navigation a:hover
    {
    background-color:#062134;
    color:#306489;
    -o-transition:.5s;
    -ms-transition:.5s;
    -moz-transition:.5s;
    -webkit-transition:.5s;
    transition:.5s;
    }

    I want the links to look like they’re in another div (wrapper, to be specific), with the help of another div.

    Help, please?

    # April 17, 2013 at 9:34 am

    I’m entirely sure what it is you are trying to do.

    Seems to be fine: http://codepen.io/Paulie-D/pen/syltf

    >I want the links to look like they’re in another div (wrapper, to be specific), with the help of another div.

    I have no idea what this means.

    # April 17, 2013 at 9:39 am

    Please note that this…

    #navigation a:link, a:visited

    should be this…

    navigation a:link, #navigation a:visited

    # April 17, 2013 at 9:41 am

    Yes, that’s exactly what I want. But I don’t know why it shows the background color as white on any browser I open. It’s weird. :S

    # April 17, 2013 at 9:42 am

    Ah! Yes, that fixed it. Thanks a lot! :)

    # April 17, 2013 at 9:47 pm

    @abhaykatre, since you just starting to learn CSS, [Here's an example . . ](http://codepen.io/jiri/pen/FCqHD “”) of slightly better coded navigation.

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

You must be logged in to reply to this topic.

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