Skip to content

How to change attributes in a svg icon in Tailwind css 4 #17393

Answered by Jobbies
Fluffy2908 asked this question in Help
Discussion options

You must be logged in to vote

Try something like this. The stroke="currentColor" is why setting the text color changes the stroke. Here are a couple of examples of changing the color, stroke and scale with tailwind. There is a link below to the same code on Tailwind Play so you can mess around with it.

<div class="flex space-x-10 p-8">
    <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
          stroke="currentColor" class="stroke-2 size-10 bg-amber-500 text-blue-400 hover:scale-125 transition duration-150 ease-in-out">
        <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 0 0 2.25- 
          2.25v-1.372c0-.516-.3…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Fluffy2908
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants