• Resolved SRCreative

    (@srcreative)


    Hi,
    I’m trying to change the colour of my nav bar so that when a user hovers it changes to pink. I’ve added the following to my style sheet but nothing happens:

    #top div.main-nav {
    a:hover
    color: #ff3399 !imporant;
    }

    Site is https://www.susierichards.com

    I’ve read loads on how to do it,inc. the above, but it’s not working!
    Thanks for your help,
    Susie

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter SRCreative

    (@srcreative)

    Thanks for the link alchymyth. I’ve corrected my code to that of the tutorial and added it to my style.css but it still doesn’t work. What am I doing wrong?

    #top div.main-nav {
    background: none;
    display: block;
    float: right;
    font-size: 18px;
    font-weight: bold;
    margin: 18px 0 0;
    padding: 4px 0;
    text-align: left;
    a:hover {color:#FF3399;}
    }

    Thread Starter SRCreative

    (@srcreative)

    any idea??? sorry but I can’t work out what i’m doing wrong…

    one step back to the basics:
    https://www.w3schools.com/css/

    untested, and only corrected for syntax:

    #top div.main-nav a: hover {
    background: none;
    display: block;
    float: right;
    font-size: 18px;
    font-weight: bold;
    margin: 18px 0 0;
    padding: 4px 0;
    text-align: left;
    }
    Thread Starter SRCreative

    (@srcreative)

    Your back to basics lessons helped me heaps on my ‘work’ page for sorting out margins/border/font colour. Thanks very much!

    BUT, the a:hover still doesn’t work. I’ve copied and pasted your code above into my style.css and added the font colour so it now reads:

    #top div.main-nav a: hover {
    background: none;
    display: block;
    float: right;
    font-size: 18px;
    font-weight: bold;
    margin: 18px 0 0;
    padding: 4px 0;
    text-align: left;
    color: #FF3399;
    }

    I’ve also tried it with just:

    #top div.main-nav a: hover {
    color: #FF3399;
    }

    and I’ve cleared my cache. I’m at a loss to know what else to try. I know this is absolutely basic coding, but I cannot see why it’s not working for me! Please help!!

    my mistake – there shouldn’t have been a space between a: and hover;

    try:

    #top div.main-nav a:hover {
    background: none;
    display: block;
    float: right;
    font-weight: bold;
    text-align: left;
    color: #FF3399;
    }

    also removed the margin, padding and font-size.

    Thread Starter SRCreative

    (@srcreative)

    It works, thank you very much! I appreciate your patience!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Added code to change hover colour but it doesn't work, any ideas??’ is closed to new replies.