指向当前页面的链接的CSS样式? [英] CSS style for links pointing to the current page?

查看:259
本文介绍了指向当前页面的链接的CSS样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道CSS3中是否有任何方式可以指向已经显示在浏览器中的相同页面的样式链接,例如在导航中突出显示红色,告诉用户您现在在这里!因为我有很少的链接列表,我希望一些用户可能会一个接一个地阅读它们。

I was wondering if there is any way in CSS3 to style links pointing to the same page that are already displayed in the browser—for example to highlight it red in the navigation telling the user "You are here right now!" since I have few lists with links, and I expect some users will probably read them one-by-one.

所以如果浏览器在 /features/feature3.php ,那么显然我想改变外观的所有链接与相同的 href 目的地。

So if the browser is at /features/feature3.php, then obviously I would like to change the appearance of all links with the same href destination.

似乎只有:hover :focus :active ,但没有什么可以解决这个问题纯粹在CSS。

It seems like there is only :hover, :focus, and :active, but nothing to solve this problem purely in CSS. Am I missing something?

推荐答案

您可以为此使用CSS3属性选择器。

you can use CSS3 attribute selectors for this.

a[href='your url'] { *** }

这篇关于指向当前页面的链接的CSS样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆