我已经为HTML页面的主容器声明了一个CSS属性。现在我想要一个ahref button有另一种颜色,但没有!important
它是不适用的。因此,我想问你我如何做到这一点。
谢谢!
另请参阅:Codepen
main a:link, main a:visited {
color: black;
text-decoration: none;
}
.test {
background-color: green;
padding: 5px 5px;
text-align: center;
text-decoration: none;
font-size: 20px;
width: 190px;
display: block;
color: white; /*is not applied*/
}
/*Another try*/
a.test {
color: white; /*is not applied, however it is with !important. But this shouldn't be the right solution?*/
}
<main>
<a href="/link" class="test">Button</a>
</main>
发布于 2018-07-08 01:53:45
删除main.a:link
中的:link
或使用您的颜色设置更具体的main a.test
样式。我试着去掉它,同时也在工作。
https://stackoverflow.com/questions/51225568
复制相似问题