li menu needs class of “selected”

前端 未结 7 1482
抹茶落季
抹茶落季 2021-01-15 18:20

when the user clicks on a menu tab i want it to remain selected with it a white button.

here is my attempt but its not working. if you click the home button it does

7条回答
  •  南笙
    南笙 (楼主)
    2021-01-15 18:33

    This'd do it. You forgot to set the selected class css

    http://fiddle.jshell.net/54uDQ/

    The important part is this css

    #navigation a:hover, #navigation a.selected
    {
    
        background: url('http://i51.tinypic.com/2iih9c9.png') no-repeat scroll 0 0 transparent;
        color: #000000;
        height: 43px;
        list-style: none outside none;
        padding-left: 10px;
        text-decoration: none;
        width: 116px;
        text-align:center
    }
    

提交回复
热议问题