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

后端 未结 7 555
日久生厌
日久生厌 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:54

    It's a server-side thing -- when rendering the page, add a class like "current-page" to the link. Then you can style it separately from the other links.

    For example, StackOverflow renders the links with class="youarehere" when it points to the page you're already on.

提交回复
热议问题