Creating a navigation bar where each link has a different hover colour

前端 未结 5 1771
梦毁少年i
梦毁少年i 2021-01-19 03:05

I\'d like to make a black navigation bar for my website, and when you hover over the first link it goes orange, the second link it goes green, etc. I know how to change colo

5条回答
  •  醉梦人生
    2021-01-19 03:32

    remove the space between li and #link2.

    #navbar ul li#link1 a:hover { 
        color: #ffffff; 
        background-color: #C62222; 
        padding-top:15px;
        padding-bottom:15px;
    }
    
    #navbar ul li#link2 a:hover { 
        color: #ffffff; 
        background-color: #28C622; 
        padding-top:15px;
        padding-bottom:15px;
    }
    

提交回复
热议问题