CSS“活跃”的字体颜色,让我疯狂

时间:2015-06-25 01:08:40

标签: css css-selectors

这个问题让我很伤心。我确信这很简单,但我觉得不够简单。

我正在教会的网站上工作,开发网址为http://commonmandesign.com/sites/stpaul/home/

问题在于,导航栏中的“活动”选项在白色背景下变为白色,我无法改变它 - 无论我做什么。我尝试的最后一件事是添加一个“活动”规则来将字体变黑,但这不起作用。然后,为了看看它是否可行,我添加了“颜色:#000;”对于处理导航栏的每个CSS规则,它仍然变为白色。

导航栏的CSS规则如下。如果有人有任何想法,我会非常感激。我一直在追逐这个bug 2个月。

谢谢!

.main-navigation {
    position: relative;
    background: #fff;
}

.site-navigation.main-navigation ul.menu,
.site-navigation.main-navigation div.menu > ul {
    margin: 0;
    padding: 0;
}

.site-navigation.main-navigation .menu li {
    display: inline-block;
    position: relative;
    margin-right: -4px;


}

.site-navigation.main-navigation .menu li:last-child{
    background-image: none;
}

.site-navigation.main-navigation .menu li a {
    color: #515659;
    display: block;
    font-size: 15px;
    text-transform: uppercase;
    line-height: 1;
    padding: 23px 19px;
    text-decoration: none;
    /*background: transparent url('images/divider.png') left center repeat-y;*/
}

.site-navigation.main-navigation .menu li:hover > a,
.site-navigation.main-navigation .menu li a:hover {
    border-bottom: 0px solid #e9e9e9;
    background: #f29120;
    color: #fff;
    -webkit-animation-name: fadeIn;
    -moz-animation-name: fadeIn;
    -o-animation-name: fadeIn;
    animation-name: fadeIn;
    animation-delay: 0.1s; /* W3C and Opera */
    -moz-animation-delay: 0.1s; /* Firefox */
    -webkit-animation-delay: 0.1s; /* Safari and Chrome */
    -webkit-animation-fill-mode:both;
    -moz-animation-fill-mode:both;
    -ms-animation-fill-mode:both;
    -o-animation-fill-mode:both;
    animation-fill-mode:both;
    -webkit-animation-duration:0.5s;
    -moz-animation-duration:0.5s;
    -ms-animation-duration:0.5s;
    -o-animation-duration:0.5s;
    animation-duration:0.5s;

}

.site-navigation.main-navigation .menu .sub-menu,
.site-navigation.main-navigation .menu .children {
    -moz-box-shadow: 0 0px 8px rgba(0,0,0,0.2);
    -webkit-box-shadow: 0 0px 8px rgba(0,0,0,0.2);
    box-shadow:0 0px 8px rgba(0,0,0,0.2);
    background:#fff;
    display: none;
    padding: 0;
    margin: 0;
    position: absolute;
    left: 0px;
    color: #515659;
    z-index: 99999;
    text-align: left;
}

.site-navigation.main-navigation .menu .sub-menu ul,
.site-navigation.main-navigation .menu .children ul {
    border-left: 0;
    left: 190px;
    top: 0;

}

.site-navigation.main-navigation .sub-menu li {
    margin-right: 0px!important;
    background-image: none!important;
}
.site-navigation.main-navigation .sub-menu li a {
    text-transform: capitalize!important;
}

.site-navigation.main-navigation .sub-menu li:hover > a {
    margin-left: 0px;
}

.site-navigation.main-navigation ul.menu ul a,
.site-navigation.main-navigation .menu ul ul a {
    color: #333;
    margin: 0;
    width: 160px;
    border-bottom: 1px solid #ccc;
}

.site-navigation.main-navigation ul.menu ul a:hover, .menu ul ul a:hover {
    color: #fff;
    border-bottom: 1px solid #ccc;
}

.site-navigation.main-navigation ul.menu li:hover > ul,
.site-navigation.main-navigation .menu ul li:hover > ul {
    display: block;
}

.site-navigation.main-navigation .menu-toggle {
    display: none;
}

4 个答案:

答案 0 :(得分:2)

您遇到的问题是将其变为白色的规则比将其变为黑色的规则更具体:

1 - .site-navigation.main-navigation .menu .current-menu-item > a {#white}
2 - .site-navigation.main-navigation .menu li a {#black}

1更具体,然后2.添加此规则,它应该变为黑色:

.site-navigation.main-navigation .menu .current-menu-item a {
    color:#000;
}

答案 1 :(得分:0)

所以两者

.site-navigation.main-navigation .menu li:hover > a,
.site-navigation.main-navigation .menu li a:hover {
    border-bottom: 0px solid #e9e9e9;
    background: #f29120;
    color: #fff;
...

.site-navigation.main-navigation ul.menu ul a:hover, .menu ul ul a:hover {
    color: #fff;
    border-bottom: 1px solid #ccc;
}

有颜色:#ff会将文字变成白色。在这两种情况下悬停。

我认为如果您使用这些颜色值,您会发现悬停时文本不会是白色。

答案 2 :(得分:0)

你的css就是这样的:

.site-navigation.main-navigation .menu .current_page_ancestor > a,  .site-navigation.main-navigation .menu .current-menu-item > a,  .site-navigation.main-navigation .menu .current-menu-ancestor > a, .entry-header-comments .read-more-button:hover, .buttonsx:hover, .error-text, .widget ul li ul li:hover { color: #fff; background: ;}

第71行(在铬源上)。如果你不想要它 - 删除它:)

答案 3 :(得分:-1)

最简单的方法是:

.share-items li a:hover {background:red !important;}