files/en-us/web/svg/reference/attribute/paint-order/index.md
The paint-order attribute specifies the order that the fill, stroke, and markers of a given shape or text element are painted.
[!NOTE] As a presentation attribute,
paint-orderalso has a CSS property counterpart: {{cssxref("paint-order")}}. When both are specified, the CSS property takes priority.
You can use this attribute with the following SVG elements:
stroke is equivalent to stroke fill markers.<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200">
<linearGradient id="g" x1="0" y1="0" x2="0" y2="1">
<stop stop-color="#888888" />
<stop stop-color="#cccccc" offset="1" />
</linearGradient>
<rect width="400" height="200" fill="url(#g)" />
<g
fill="crimson"
stroke="white"
stroke-width="6"
stroke-linejoin="round"
text-anchor="middle"
font-family="sans-serif"
font-size="50px"
font-weight="bold">
<text x="200" y="75">stroke over</text>
<text x="200" y="150" paint-order="stroke" id="stroke-under">
stroke under
</text>
</g>
</svg>
The example would be rendered as follows:
The stroke under effect could be achieved via the following CSS property:
#stroke-under {
paint-order: stroke;
}
{{Specifications}}
{{Compat}}