CSS paint-order Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The paint-order property controls the order in which fill, stroke, and markers are drawn on SVG shapes and text. The default paints fill first, then stroke, then markers.

It is inherited. The initial value is normal. A thick stroke often looks better behind the fill—set paint-order: stroke fill for that.

Note Markers are SVG-only

markers applies to SVG shapes that use marker-*. For HTML text you mainly reorder stroke and fill (often with -webkit-text-stroke).

CSS Syntax

syntax.css
paint-order: normal | [ fill || stroke || markers ] | initial | inherit;

List one, two, or three keywords. Listed layers paint first, in that order. Omitted layers keep their default relative order after them.

Property Values

ValueDescriptionTry it
normalDefault order: fill → stroke → markersTry it
strokePaint stroke first, then fill and markersTry it
stroke fillStroke, then fill, then markers — common for outlined textTry it
markersPaint markers first (SVG marker shapes)Try it
initialResets to normalTry it
inheritTakes the parent’s paint-orderTry it

How to Use paint-order

Use it when fill and stroke overlap and you care which layer sits on top.

  1. Give the SVG shape or text a fill, stroke, and a visible stroke-width.
  2. Leave the default, or set paint-order: stroke fill so the fill covers the inner half of the stroke.
  3. Compare both orders side by side until the outline looks right.
  4. Add markers only when the shape uses SVG markers.
PieceRequired?Role
SVG shape or textYes (typical)Needs fill and/or stroke painting
stroke + widthYes (to see the effect)A thick stroke makes order changes obvious
Keyword listYesnormal or any order of fill / stroke / markers
MarkersOptionalOnly for SVG paths that use <marker>

Live Preview

Watch how a thick red stroke sits relative to the dark fill when you change the paint order.

normal paints fill then stroke. stroke fill puts the stroke behind the fill.

SVG text preview
Outlined SVG text using paint-orderCodeToFun

paint-order: stroke fill

CSS Examples

Each snippet focuses on paint-order. Fill and stroke are only there so you can see the order. Use Try It Yourself for a live editor.

Example 1 — Default Order

Fill paints first. The stroke sits on top and can cover the letter edges.

CSS
<style>
  text {
    fill: #0f172a;
    stroke: #ef4444;
    stroke-width: 8px;
    paint-order: normal;
  }
</style>

<svg viewBox="0 0 280 80" width="280" height="80">
  <text x="8" y="55" font-size="48" font-weight="700">Hello</text>
</svg>
Try It Yourself

How It Works

  1. Set fill and stroke. Without both, order changes are hard to see.
  2. Use normal. That means fill → stroke → markers.
  3. Stroke wins the edge. A thick stroke paints over the fill near the outline.
  4. Same as initial. Leaving the property off behaves like normal.

Example 2 — Stroke Behind Fill

Paint the stroke first so the fill covers the inner half of the outline.

CSS
<style>
  text {
    fill: #0f172a;
    stroke: #ef4444;
    stroke-width: 8px;
    paint-order: stroke fill;
  }
</style>

<svg viewBox="0 0 280 80" width="280" height="80">
  <text x="8" y="55" font-size="48" font-weight="700">Hello</text>
</svg>
Try It Yourself

How It Works

  1. List stroke, then fill. Stroke paints first; fill paints second.
  2. Markers last. The omitted markers layer stays last by default.
  3. Cleaner letters. The fill covers the stroke that overlaps the glyph interior.
  4. Most common fix. Use this when thick outlines look muddy with normal.

Example 3 — Single Keyword

One keyword paints first. The other layers keep their default relative order after it.

CSS
<style>
  text {
    fill: #0f172a;
    stroke: #ef4444;
    stroke-width: 8px;
    paint-order: stroke;
  }
</style>

<svg viewBox="0 0 280 80" width="280" height="80">
  <text x="8" y="55" font-size="48" font-weight="700">Hello</text>
</svg>
Try It Yourself

How It Works

  1. Name one layer. That layer paints first.
  2. Defaults follow. Remaining layers keep fill-before-markers relative order.
  3. Same look here. For fill + stroke only, stroke matches stroke fill.
  4. Use markers when needed. Add markers when SVG markers are part of the graphic.

Edge Cases & Pitfalls

If the outline still looks wrong, check these first.

stroke

Needs a visible stroke

Without stroke and a thick enough stroke-width, changing order has little visible effect.

markers

markers needs SVG markers

HTML text ignores markers. Use marker elements on SVG paths when that keyword matters.

html

HTML text needs a stroke source

Browsers often stroke HTML text with -webkit-text-stroke. Pair that with paint-order for filled outlines.

omit

Omitted layers keep default order

Listing one or two keywords does not drop the others—they paint afterward in their normal relative order.

scope

Not a general stacking property

It does not replace opacity, mix-blend-mode, or z-index. It only orders fill / stroke / markers on the same shape.

Browser Support

paint-order is a browser rendering property for SVG and stroked text. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

paint-order

Interoperable across modern browsers. Full CSS support from Chrome/Edge 123+, with earlier support in Firefox and Safari.

97% Modern browsers
Google Chrome 123+
Full
Mozilla Firefox 60+
Full
Apple Safari 11+
Full
Microsoft Edge 123+
Full
Opera 109+
Full
Samsung Internet 27+
Full
Internet Explorer No
None
paint-order Widely supported

Bottom line: Safe for modern sites. Older Chromium before 123 had partial SVG-attribute support; IE does not support it.

Key Takeaways

  • Role: choose which paints first among fill, stroke, and markers.
  • Default: normal = fill → stroke → markers.
  • Go-to value: stroke fill for cleaner outlined SVG text.
  • Inherited: yes. Markers matter only with SVG <marker> usage.

One line: paint-order decides whether the stroke sits on top of the fill or behind it.

Frequently Asked Questions

It controls the order in which fill, stroke, and markers are painted on SVG shapes and text. Changing the order changes how thick strokes and fills overlap.
The initial value is normal, which paints fill first, then stroke, then markers.
Use it when a thick stroke should sit behind the fill. Outlined SVG text often looks cleaner with the fill painted on top.
No. Markers apply to SVG shapes that use marker-* properties. For HTML text you mainly choose between stroke and fill order.
Yes. That layer paints first. The remaining layers keep their default relative order after it.
It is Baseline Widely available. Full CSS support landed across major browsers around Chrome/Edge 123, with earlier support in Firefox and Safari. It is a browser rendering property, not a Node.js feature.

Next: perspective

Learn how CSS perspective creates 3D depth for transformed elements.

perspective tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful