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
-
To let SVG icons use the text color, you can set
fill-current
on the SVG element. Then it will inherit the text color from its parent.https://tailwindcss.com/docs/fill/
fill-current
on the bodyI noticed that I could set
fill-current
not on the SVG itself but on the parent element, because its inherited up the DOM.Taking it one step futher, we can set
fill-current
on 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-current
andtext-red-500
does not need to be direct parents to the SVG file.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions