paint-order
Quick Summary for paint-order
The paint-order CSS property lets you control the order in which the fill and stroke (and painting markers) of text content and shapes are drawn.
Code Usage for paint-order
/* Normal */ paint-order: normal;  /* Single values */ paint-order: stroke; /* draw the stroke first, then fill and markers */ paint-order: markers; /* draw the markers first, then fill and stroke */  /* Multiple values */ paint-order: stroke fill; /* draw the stroke first, then the fill, then the markers */ paint-order: markers stroke fill; /* draw markers, then stroke, then fill */  /* Global values */ paint-order: inherit; paint-order: initial; paint-order: revert; paint-order: unset; 
More Details for paint-order

paint-order

The paint-order CSS property lets you control the order in which the fill and stroke (and painting markers) of text content and shapes are drawn.

Syntax

/* Normal */ paint-order: normal;  /* Single values */ paint-order: stroke; /* draw the stroke first, then fill and markers */ paint-order: markers; /* draw the markers first, then fill and stroke */  /* Multiple values */ paint-order: stroke fill; /* draw the stroke first, then the fill, then the markers */ paint-order: markers stroke fill; /* draw markers, then stroke, then fill */  /* Global values */ paint-order: inherit; paint-order: initial; paint-order: revert; paint-order: unset; 

If no value is specified, the default paint order is fill, stroke, markers.

When one value is specified, that one is painted first, followed by the other two in their default order relative to one another. When two values are specified, they will be painted in the order they are specified in, followed by the unspecified one.

Note: In the case of this property, markers are only appropriate when drawing SVG shapes involving the use of the marker-* properties (e.g. marker-start) and <marker> element. They do not apply to HTML text, so in that case, you can only determine the order of stroke and fill.

Values

normal

Paint the different items in normal paint order.

stroke, fill, markers

Specify some or all of these values in the order you want them to be painted in.

Formal definition

Initial valuenormal
Applies totext elements
Inheritedyes
Computed valueas specified
Animation typediscrete

Formal syntax

normal | [ fill || stroke || markers ]

Examples

Reversing the paint order of stroke and fill

SVG
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="200">   <text x="10" y="75">stroke in front</text>   <text x="10" y="150" class="stroke-behind">stroke behind</text> </svg> 
CSS
text {   font-family: sans-serif;   font-size: 50px;   font-weight: bold;   fill: black;   stroke: red;   stroke-width: 4px; }  .stroke-behind {   paint-order: stroke fill; } 
Result

Specifications

Specification
Scalable Vector Graphics (SVG) 1.1 (Second Edition) # PaintOrder

See also

CSS Tricks: paint-order Select your preferred language English (US)Français日本語한국어Русский中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
⠄⠄⣿⣿⣿⣿⠘⡿⢛⣿⣿⣿⣿⣿⣧⢻⣿⣿⠃⠸⣿⣿⣿⠄⠄⠄⠄⠄
⠄⠄⣿⣿⣿⣿⢀⠼⣛⣛⣭⢭⣟⣛⣛⣛⠿⠿⢆⡠⢿⣿⣿⠄⠄⠄⠄⠄
⠄⠄⠸⣿⣿⢣⢶⣟⣿⣖⣿⣷⣻⣮⡿⣽⣿⣻⣖⣶⣤⣭⡉⠄⠄⠄⠄⠄
⠄⠄⠄⢹⠣⣛⣣⣭⣭⣭⣁⡛⠻⢽⣿⣿⣿⣿⢻⣿⣿⣿⣽⡧⡄⠄⠄⠄
⠄⠄⠄⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣶⣌⡛⢿⣽⢘⣿⣷⣿⡻⠏⣛⣀⠄⠄
⠄⠄⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠙⡅⣿⠚⣡⣴⣿⣿⣿⡆⠄
⠄⠄⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠄⣱⣾⣿⣿⣿⣿⣿⣿⠄
⠄⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢸⣿⣿⣿⣿⣿⣿⣿⣿⠄
⠄⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠣⣿⣿⣿⣿⣿⣿⣿⣿⣿⠄
⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠑⣿⣮⣝⣛⠿⠿⣿⣿⣿⣿⠄
⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⠄⠄⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠄

Random CSS Property

:only-child

The :only-child CSS pseudo-class represents an element without any siblings. This is the same as :first-child:last-child or :nth-child(1):nth-last-child(1), but with a lower specificity.
:only-child css reference