CSS:覆盖活动链接样式? [英] css: override active link style?
本文介绍了CSS:覆盖活动链接样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的CSS中有以下选择器:
i have the following selector in my css:
a:active {
position: relative;
top: 1px;
}
因此,每个链接在按下时都具有这个小的按钮效果。
So every link has this little button-effect when it's pressed.
如何防止特定链接的这种行为?
How can i prevent that behaviour for specific links?
例如我在我的网站上有一个不应具有此行为的返回页首链接。
e.g. i have a "back to top" link on my website that shouldn't have this behaviour.
a#back-to-top {
position:fixed;
right:0px;
bottom:20px;
width:20px;
height:20px;
background:green;
}
在这种情况下,从头到尾开始跳跃。
但是,如果我尝试重置它,将无法正常工作。
In this case the "back-to-top" starts to jump. However if I try to reset this it doesn't work.
a#back-to-top:active {
position:fixed !important;
bottom:20px !important;
}
任何想法我做错了什么或如何排除特定链接
any idea what I'm doing wrong or how I could exclude specific links from that active behaviour?
推荐答案
尝试重置 top
属性。
a#back-to-top:active {
position: fixed !important;
top: auto !important;
}
这篇关于CSS:覆盖活动链接样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文