MasterPtato MasterPtato - 15 days ago 5
CSS Question

CSS Text-Shadow color

Is it possible to make the text-shadow property inherit color? like maybe:

text-shadow: 1px 2px inherit;


I know this won't work but if there is another way, please show me.

Answer

You can try currentcolor:

The currentColor keyword represents the calculated value of the element's color property. It allows to make the color properties inherited by properties or child's element properties that do not inherit it by default.

p {
  text-shadow: 1px 2px currentcolor;
}
<p style="color: red">Red</p>
<p style="color: green">Green</p>
<p style="color: blue">Blue</p>