简体   繁体   English

css 链接在文本内时的颜色继承

[英]css color inhertance when the link is inside the text

The color of text is set to white inside the container, which has text in it.文本颜色在容器内设置为白色,其中包含文本。 But the link inside the text is not showing up as white instead blue.但是文本中的链接没有显示为白色而是蓝色。

I am using material ui styles.我正在使用材料 ui styles。

have tried,important tag , still not working已经试过了,重要的标签,还是不行

this problem may have occured because you linked another library that override your css If this is correct you should link your css after the link of the library发生此问题可能是因为您链接了另一个覆盖您的 css 的库如果这是正确的,您应该在库的链接之后链接您的 css

<link rel='stylesheet' href='library'>
<link rel='stylesheet' href='your_css'>

or you can do that或者你可以这样做

.container a {
  color: white !important;
}

I hope this helps you我希望这可以帮助你

The default css color value of an a tag is not inherit but an internal value, so to change the color of the link you have to specify a css rule for the a tag or use a class a 标签的默认css 颜色值不是继承而是内部值,因此要更改链接的颜色,您必须为 a 标签指定 css 规则或使用 class

a {
   color: white;
}

/* or */

.link {
   color: white;
}
<div>
some text .... <a class="link" href="">link</a>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM