Make Twitter Bootstrap navbar link active

前端 未结 9 1090
情深已故
情深已故 2020-11-30 21:33

What\'s the standard way to make the active link in a Twitter Bootstrap navbar bolded? It\'s clear that a link gains the active appearance by gaining the \"active\" class. F

9条回答
  •  暖寄归人
    2020-11-30 21:52

    You can solve it with CSS.

    Add a class to the body of each page:

    
    

    Or if you're on the contact page:

    
    

    Then take this into consideration when you're creating your styles:

    ul li:hover, body.home a.home, body.contact a.contact { background-color: #000; } 
    ul li:hover a, body.home li.home a, body.contact li.contact a { color: #fff; }
    

    Lastly, apply class names to your list items:

    
    

    This point, whenever you're on the body.home page, your li.home a link will have default styling indicating it is the current page.

提交回复
热议问题