fill-current on the body is really clever #2110
jenstornell
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
To let SVG icons use the text color, you can set
fill-currenton the SVG element. Then it will inherit the text color from its parent.https://tailwindcss.com/docs/fill/
fill-currenton the bodyI noticed that I could set
fill-currentnot on the SVG itself but on the parent element, because its inherited up the DOM.Taking it one step futher, we can set
fill-currenton the body element. This allows for coloring all SVG files with the text color from the parent.In the example above the SVG file is lower down the DOM. The
fill-currentandtext-red-500does not need to be direct parents to the SVG file.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions