fill="red"style attribute for an element. For example: style="fill: red;"style element. For example: <style>".st0{fill: red;}</style>"fill. See also Gradients supportstrokefont-familyfont-sizefont-weightfont-styletext-decorationbaseline-shift on tspan elementsopacityfill-opacitystyleclassclipPathfilter: see filters supportopacity and transform attributes are supported for all elements.
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" viewBox="0 0 200 200"> <g> <rect fill="red" width="100" height="100" x="50" y="50" /> </g> </svg>
style attribute[2]
:fillstrokefont-familyfont-sizefont-weightfont-styletext-decorationopacityfill-opacityclipPath<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" viewBox="0 0 200 200"> <g> <rect style="fill:red;" width="100" height="100" x="50" y="50" /> </g> </svg>
style element[3]
, and can be accessed through the class attribute[4]
:fillstrokestroke-widthstroke-dasharrayfont-familyfont-sizefont-weightfont-styletext-decorationopacityfill-opacity<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200" viewBox="0 0 200 200"> <style>.st0{fill: red;}</style> <g> <rect class="st0" width="100" height="100" x="50" y="50" /> </g> </svg>
Copyright 2021-2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD-3-Clause License