gpt4 book ai didi

html - CSS a-Tag 链接颜色 : Particular change for a class

转载 作者:行者123 更新时间:2023-11-28 01:26:21 25 4
gpt4 key购买 nike

我已经为 HTML 页面的主容器声明了一个 CSS 属性。现在我想要一个 ahref 按钮有另一种颜色,但是没有 !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>

最佳答案

删除 main.a:link 中的 :link 或使用您的颜色设置更具体的 main a.test 样式。我尝试将其删除并正常工作

关于html - CSS a-Tag 链接颜色 : Particular change for a class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51225568/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com