Design comparison
Solution retrospective
Hey guys how do i change the color of an svg i tried to do it but i could not get the desired color and I'm sure there are other things that need to be addressed as always any feedback is greatly appreciated
Community feedback
- @detachedsoulPosted over 3 years ago
I would also suggest you remove the outline of your input when focused.
0 - @detachedsoulPosted over 3 years ago
To change the color of an svg, you can give the svg a class, id, or even use the svg tag and do something like:
svg { fill: your color; }
or if you decide to use a class:
.your-class{ fill: your color; }
Please note that the class should be one the svg itself. Also your svg shouldn't be used in an img tag for this to work. You can just copy the full svg code. For example , instead of doing:
<img src="svg-file.svg">
you would do something like:
<svg width="60" height="64" viewBox="0 0 60 64" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M29.8043 0C13.3702 0 0 12.5701 0 28.0207C0 29.733 0 42.9785 0 43.2142C0 " fill="#2C99B0"/> </svg>
In your case the code would be the svg's code. Just use a code editor to get the code of the svg you are trying to use and give the svg a class. Hope it helps!
0@BrezusPosted over 3 years ago@detachedsoul thank you i tried it and i couldn't get it to work i figure maybe i am just doing something wrong but the next time i come across this kind of challenge i will give this method a try plus i had no idea that i could just copy the svg code into HTML lol a million thanks again!
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord