Home>Article>Web Front-end> How to change svg color with css
In CSS, you can use the stroke attribute to change the color of svg. You only need to set the "stroke: color value" style for the polyline tag in svg. The stroke attribute defines a line, text or element outline color, the value is the same as color, and supports rgba transparent channel.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
Sometimes we may use css to directly control svg. svg can be used in the form of images like jpg and png, or directly in the form of tags. The former cannot set the color, but the latter can.
Example:
Effect:
Add the code to change the color
svg g polyline { stroke: red; }
Effect:
Recommended learning:css video tutorial
The above is the detailed content of How to change svg color with css. For more information, please follow other related articles on the PHP Chinese website!