The paint-order property controls the order in which fill, stroke, and markers are painted on SVG graphics. It is especially useful when thick strokes and fills overlap.
01
Fill & Stroke
Layer SVG paints.
02
Syntax
Reorder keywords.
03
normal
Default order.
04
stroke fill
Common pattern.
05
Markers
Arrowheads & dots.
06
SVG Text
Outlined lettering.
Fundamentals
Introduction
The paint-order property in CSS is used to control the order in which the fill, stroke, and markers of SVG graphics are painted.
This property is particularly useful when you want to ensure that certain parts of your SVG are rendered in a specific sequence, which can affect the visual appearance and layering of the graphic.
Definition and Usage
By default, browsers paint the fill first, then the stroke, then markers such as arrowheads on lines. With paint-order, you can change that sequence — for example, painting the stroke before the fill so the fill sits on top.
This is most common on inline or embedded SVG shapes and SVG text that use both fill and stroke properties.
💡
Beginner Tip
If a thick stroke looks like it is eating into your fill, try paint-order: stroke fill. That paints the stroke first and the fill second, so the fill stays visually on top.
Foundation
📝 Syntax
The syntax for the paint-order property allows you to specify the order of painting for the fill, stroke, and markers.
syntax.css
element{paint-order:fillstrokemarkers;}
Each of the values (fill, stroke, markers) can be used in any order and can be omitted if not needed.
Both rectangles use the same colors and stroke width. Only the paint order changes, which alters how much of the stroke remains visible around the fill.
📝 SVG Text & Markers
Apply paint order to outlined text and lines with arrow markers.
Example 3 — Outlined SVG Text
Use paint-order: stroke fill on SVG text so a thick stroke sits behind crisp fill lettering.
Markers are a third paint layer on lines and paths. Custom order helps when arrowheads should appear above or below the stroke in complex diagrams.
Companion
Understanding fill, stroke, and markers
Think of an SVG shape as three paint layers. fill colors the inside, stroke outlines the edge, and markers add decorations such as arrowheads on lines.
The default normal order is fill → stroke → markers. Use paint-order when you need a different stacking result without changing your colors or geometry.
paint-layers.css
/* Default */svg path{paint-order:normal;/* fill, stroke, markers */}/* Common custom order */svg text{paint-order:strokefill;}
🧠 How paint-order Works
1
SVG defines shape geometry
A rectangle, path, line, or text element defines what will be drawn.
SVG markup
2
You set fill, stroke, and paint-order
CSS chooses colors, stroke width, and the order those paints are applied.
CSS rule
3
The browser paints each layer
Layers are drawn in your chosen sequence. Later layers appear on top of earlier ones.
Rendering
=
🎨
Precise visual layering
Stroke, fill, and markers overlap exactly the way your design needs.
Compatibility
Browser Compatibility
The paint-order property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.
✓ SVG · Widely supported
Reliable SVG paint-order control
Chrome, Firefox, Safari, Edge, and Opera support paint-order on SVG content.
94%Modern browser support
Google Chrome35+ · Desktop & Mobile
Full support
Mozilla Firefox60+ · Desktop & Mobile
Full support
Apple Safari8+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera22+ · Modern versions
Full support
Testing tip
Compare normal and stroke fill side by side in your target browsers, especially when using thick strokes or SVG text outlines.
paint-order property94% supported
Bottom line:paint-order is well supported for SVG in modern browsers. Always verify the visual result when stroke widths are large.
Wrap Up
Conclusion
The paint-order property is a valuable tool for web developers working with SVG graphics.
By controlling the painting order of fill, stroke, and markers, you can achieve precise visual effects and ensure that your graphics are rendered exactly as intended. Experiment with different painting orders to see how this property can enhance the appearance of your SVG elements.
Use paint-order: stroke fill for outlined SVG text and icons
Compare normal and custom order when using thick stroke-width
Keep stroke and fill colors defined in CSS for easy tuning
Test SVG graphics in every target browser
Document non-default paint order when it is required for the design
❌ Don’t
Expect paint-order to affect plain HTML boxes without SVG presentation
Assume a custom order fixes layout problems — geometry still matters
Use extreme stroke widths without checking readability
Forget that omitted values still follow the default relative order
Skip visual testing on mobile browsers for icon sets
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about paint-order
Use these points when layering fill, stroke, and markers in SVG.
5
Core concepts
🎨01
SVG Layers
Fill, stroke, markers.
Purpose
⚙02
normal Default
fill → stroke → markers.
Default
▦03
stroke fill
Fill on top.
Pattern
📝04
SVG Text
Outlined lettering.
Use case
→05
markers
Arrowheads on lines.
Keyword
❓ Frequently Asked Questions
The paint-order property controls the order in which fill, stroke, and markers are painted on SVG shapes and text. Changing the order can change how thick strokes and fills overlap.
The default value is normal, which paints fill first, then stroke, then markers.
Use stroke fill when you want the fill painted on top of the stroke. This is common for outlined SVG text and shapes where a thick stroke should sit behind the fill.
paint-order is mainly useful for SVG graphics and text that have fill and stroke. It does not affect typical block-level HTML elements without SVG presentation.
Yes. You can list fill, stroke, and markers in any order and omit values you do not need. Omitted parts keep their default relative order after the listed values.