首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >CSS a-Tag Linkcolor:类的特殊更改

CSS a-Tag Linkcolor:类的特殊更改
EN

Stack Overflow用户
提问于 2018-07-08 01:43:24
回答 1查看 9关注 0票数 0

我已经为HTML页面的主容器声明了一个CSS属性。现在我想要一个ahref button有另一种颜色,但没有!important它是不适用的。因此,我想问你我如何做到这一点。

谢谢!

另请参阅:Codepen

代码语言:javascript
复制
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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-07-08 01:53:45

删除main.a:link中的:link或使用您的颜色设置更具体的main a.test样式。我试着去掉它,同时也在工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51225568

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档