Tailwindcss: Linked SVG Colors

Created on 14 Nov 2017  路  6Comments  路  Source: tailwindlabs/tailwindcss

Following the examples, it's easy enough to use the text color to change an inline SVG, but what about linked ones? Some I have are too long to effectively use inline. I've tried putting the text color on the img tag as well as the svg tag in the file itself, but neither work. Any ideas?

Most helpful comment

Alas, @adamwathan is only a mere human. 馃槀

All 6 comments

Hey @scottzirkel! Unfortunately it's not possible to style SVGs that are linked through img tags; only inline SVG can be properly styled with CSS.

Here's a good article on it:

https://css-tricks.com/using-svg/

Your best bet for styling non-inline SVG is to embed the styling information into the SVG itself unfortunately.

Bummer, but kinda what I figured. Thought maybe you were smart enough to figure a way around that. Guess not.

Alas, @adamwathan is only a mere human. 馃槀

@scottzirkel A more readable way would be to use a blade partial, Vue component, ... and pass the classes into the partial. 馃檪
But that would not help with plain html ofcourse. 馃槙

I was so focused on getting the design done, I didn't even think about breaking the blade apart yet. Thanks @MichaelDeBoey!

You're welcome @scottzirkel 馃檪
Got the trick from @adamwathan in one of his 'Building @kitetail' streams 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dbpolito picture dbpolito  路  3Comments

ouun picture ouun  路  3Comments

manniL picture manniL  路  3Comments

AlexVipond picture AlexVipond  路  3Comments

rgaufman picture rgaufman  路  3Comments