我正在尝试为h2和a:link更改以下类的颜色,但它不起作用。这是我到目前为止所做的:
<div id="post-1132" class="post-1132 news type-news status-publish hentry category-news">
<h2><a href="http://domain.com/index.php/news/news9/" title="Midwest premium rises to 6-month high">Midwest premium rises to 6-month high</a></h2>
<div class="post-info">
<span class="date published time" title="2015-12-05T09:27:58+00:00">December 5, 2015</span>
</div>
<div class="entry-content">
<div class="summary"><p>NEW YORK The Midwest aluminum premium has yielded another bump following the Thanksgiving break,
reaching its highest level in more than six months. AMMs assessment of the spot P1020 premium rose to 8.75 to 9 cents
per pound from 8.5 to 8.75 cents per pound previously. The premium last topped this level on May
<a href="http://asc100.com/index.php/news/news9/">Continue Reading →</a></p>
<a class="moretag" href="http://domain.com/index.php/news/news9/"> Read the full news article</a></div>
</div>
</div><!-- post -->
.hentry h2 {
font-size: 18px;
height: 0px;
color: #125CAA;
}
div.summary a:link{
text-decoration: underline;
color: #125CAA !important;
}
感谢您的期待
答案 0 :(得分:3)
从那里删除:link
:
.summary a {
text-decoration: underline;
color: #125CAA;
}
这应该没有!important
。使用!important
不是一个好主意。
为什么它不适合您的原因是,您可能已访问过此链接,因此:visited
只能正常工作。
在CSS中添加:
#single #primary {float: left; width: 75%;}
#single #sidebar {float: right; width: 20%; margin-top: 150px;}
WP-PageNavi将为您提供:
答案 1 :(得分:0)
您需要为h2内的标记指定更多内容,如下所示:
.hentry h2 {
font-size: 18px;
height: 0px;
}
.hentry h2 a { color: #125CAA; }
div.summary a:link{
text-decoration: underline;
color: #125CAA;
}
正如您在此codepen中看到的那样,h2标记中的文字为红色,但由于继承规则,其中没有a