简体   繁体   中英

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.

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

<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 {
   color: white;
}

/* or */

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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