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 supportstroke
font-family
font-size
font-weight
font-style
text-decoration
baseline-shift
on tspan
elementsopacity
fill-opacity
style
class
clipPath
filter
: 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]
: fill
stroke
font-family
font-size
font-weight
font-style
text-decoration
opacity
fill-opacity
clipPath
<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]
: fill
stroke
stroke-width
stroke-dasharray
font-family
font-size
font-weight
font-style
text-decoration
opacity
fill-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