这是我的<style>中的css
a {
transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
outline: none;
color: #161616;
text-decoration: none;
}
a:hover, a:focus {
color: #D6D6D6;
outline: none;
text-decoration: none;
}然后我的链接是黑色的,在悬停时是灰色的。但当我将颜色放入entry content a时,如下所示:
.entry-content a {
color: #E5C9CC;
}
然后我的链接是粉红色的,没有灰色的悬停,我不知道为什么。
我不希望我的博客上的所有链接都是粉色的,只有我的条目中的链接需要粉红色并带有灰色的悬停。
发布于 2017-02-24 00:13:47
尝尝这个
.entry-content a {
color: #E5C9CC;
}
a {
transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
outline: none;
color: #161616;
text-decoration: none;
}
a:hover, a:focus {
color: #D6D6D6;
outline: none;
text-decoration: none;
}<a href="#">Link #1</a><br />
<a href="#">Link #2</a>
<div class="entry-content">
<a href="#">Link into div</a>
</div>
发布于 2017-02-24 00:12:14
也许,像这样
.entry-content a {
color: #161616;
}
.entry-content a:hover {
color: #D6D6D6;
}
发布于 2017-02-24 00:14:21
试试这个:
a {
transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
outline: none;
color: #161616;
text-decoration: none;
}
.entry-content a {
color: #E5C9CC;
}
a:hover, a:focus, .entry-content a:hover, .entry-content a:focus {
color: #D6D6D6;
outline: none;
text-decoration: none;
}选择器的顺序和具体程度非常重要。如果指定悬停样式也应用于entry-content,则悬停样式将起作用
https://stackoverflow.com/questions/42420759
复制相似问题