且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用CSS更改当前页面的链接颜色

更新时间:2023-01-28 13:30:38

a:active :当您点击链接并按住它( active!)。

a:visited :当链接已被访问时。

a:active : when you click on the link and hold it (active!).
a:visited : when the link has already been visited.

如果您希望突出显示当前页面对应的链接,可以为链接定义一些特定样式 -

If you want the link corresponding to current page to be highlighted, you can define some specific style to the link -

.currentLink {
   color: #640200;
   background-color: #000000;
}

将此新类仅添加到相应的 / code>(链接),在服务器端或客户端(使用javascript)。

Add this new class only to the corresponding li (link), either on server-side or on client-side (using javascript).