SVG CSS Styling
When an SVG image's raw code (XML
) is embedded in a component or template, it becomes a special DOM element, whose objects are available for CSS styling via ID
or class
selector.
Inkscape V1.4 objects have an ID
property field in their Object Properties
panel.
To add a class selector to an SVG object:
Object Properties
and select +
in bottom, left of panel (Add a new CSS Selector
)..some-class-name
when prompted for CSS Selector
Common SVG attributes used to style SVGs include:
fill
and stroke
stroke-width
, stroke-linecap
and stroke-linejoin
opacity
, fill-opacity
and stroke-opacity
font-family
, font-size
and font-weight
SVGs must be inlined in HTML ('.html', template, component etc.) in order to style its objects using its class
or id
selectors.