How do I highlight a link based on the current page?

后端 未结 7 512
日久生厌
日久生厌 2020-12-30 08:21

Sorry if this sounds like a really stupid question, but I need to make a link change colour when you are on the page it links to.

For example, when you are on the \"

7条回答
  •  隐瞒了意图╮
    2020-12-30 08:53

    Set a class on the body tag for each page (manually or server-side). Then in your CSS use that class to identify which page you're on and update the style on the item accordingly.

    body.questions #questionsTab
    {
        color: #f00;
    }
    

    Here's a good longer explanation

提交回复
热议问题