My code is shown below. However, nothing is applied to the svg. What is the best way to resolve this?
.icon { width: 250px; height: 250px; background-color: chartreuse; } .icon > svg { fill: brown; width: 100%; height: 100%; }
2
Remove the inline style fill="none", width="37" and height="36" from svg.
fill="none"
width="37"
height="36"
A trick I use is to give a color property to the parent element, in this case .icon and have the svg css as fill: currentColor
color
.icon
fill: currentColor
.icon { color: brown; /* Rest of your code */ } .icon > svg { fill: currentColor; /* Rest of your code */ }
More details here
Click here to cancel reply.
2
Answers
Remove the inline style
fill="none"
,width="37"
andheight="36"
from svg.A trick I use is to give a
color
property to the parent element, in this case.icon
and have the svg css asfill: currentColor
More details here