Styles and CSS in SVG
SVGs exported with class-based CSS can be flattened into presentational attributes for portability. Run style plugins in the right order — merge before inline — and compare the preview when toggling convertStyleToAttrs.
SVGO plugins in this topic
- Merge styles
mergeStylesCombines multiple <style> elements and merges rules where possible before inlining or minifying.
- Inline styles
inlineStylesMoves CSS rules from <style> blocks onto matching elements as attributes.
- Minify styles
minifyStylesMinifies CSS inside <style> elements (whitespace, redundant syntax) before or instead of inlining.
- Style to attributes
convertStyleToAttrsConverts simple CSS declarations on elements into presentational SVG attributes.
- Remove style elements
removeStyleElementRemoves entire <style> blocks after styles have been inlined or are unused.
Related topics
Try it
Open SVGOMG.net, load your SVG, and toggle the plugins above in the Features panel.