我的CSS有什么问题?活动链接不改变颜色 [英] what is wrong with my css? active links not changing color
本文介绍了我的CSS有什么问题?活动链接不改变颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法让我的Wordpress菜单活动链接保持红色。
I cannot get my Wordpress menu active links to remain red.
我添加了我认为与导航相关的CSS,还有正文,等,以防影响问题。
I've added the CSS I think is relevant to the navigation of, but also the body, etc, in case that is impacting the issue.
感谢您的帮助!
body {
font-family: 'Helvetica Neue', sans-serif;
font-size: 12px;
line-height: 18px;
color: #000;
}
/*
LINKS
*/
a:link,
a:visited {
text-decoration: none;
color: #000;
}
a:hover {
text-decoration: none;
color: #ff0000 ;
}
a:active {
color: #ff0000;
}
h2.entry-title-index a:link,
h2.entry-title-index a:active,
h2.entry-title-index a:visited {
text-decoration: none;
color: #ff0000;
}
h2.entry-title-index a:hover {
text-decoration: none;
color: #ff0000;
}
a:active {
color: #ff0000 !important;
}
/*
HEADLINES
*/
h2, #navigation {
font-family: 'Helvetica Neue', sans-serif;
margin: 0;
font-size: 16subpx;
font-style: normal;
font-variant: normal;
font-weight: 450;
line-height: 18px;
}
#navigation a:hover::before {
content: '+ ';
}
#navigation a:active::before {
content: '+ ';
}
#navigation ul a.active {
color: #ff0000;
}
h2.entry-title, h2.entry-title-index, h2.comment-title {
margin-top:14px;
color: #ff0000;
}
h2.entry-title, h2.comment-title {
/* margin: 0 0 9px 0; */
}
h2.entry-title-index {
line-height: 17px !important;
/* margin: 9px 0 0 0 !important; */
}
推荐答案
仅使用活动当用户点击某个元素时,并不意味着指示哪个页面处于活动状态。您应该在活动导航项中添加一个类并设置该类的样式。
Active is only used while a user is clicking on an element, it's not meant to indicate which page is active. You should add a class to the active navigation item and style that class.
source: http://css-tricks.com/almanac/selectors/a/active/
这篇关于我的CSS有什么问题?活动链接不改变颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文