First Public Working Draft · fill-stroke

CSS Fill and Stroke

26 properties defined by this specification, 10 of them known to at least one browser (the others are badged Not in any browser yet).

Each feature in detail

fill-break

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

bounding-box | slice | clone

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
bounding-box
Applies to
all elements
Inherited
yes?
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

fill-color

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<color>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
currentcolor
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
the computed color
Canonical order
per grammar
Animation type
by computed value

fill-image

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<paint>#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
none
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
as specified, with any <image> computed
Canonical order
per grammar
Animation type
repeatable list

fill-opacity

Property Baseline: widely availablesince ≤ September 2022

MDN The fill-opacity CSS property defines the opacity of the painting operation (color, gradient, pattern, etc.) applied to SVG shapes or text content elements to fill the element. The property defines the opacity of the element's fill only; it does not affect the stroke. If present, it overrides the element's fill-opacity attribute.

Live preview Example from MDN
svg {
  border: 1px solid;
  height: calc(100vh - 20px);
  background: repeating-linear-gradient(
    to bottom right,
    transparent 0 10px,
    #cccccc 10px 11px
  );
}

svg > * {
  fill: black;
}
rect:last-of-type {
  fill-opacity: 0.1;
}
circle {
  fill-opacity: 0.6;
}
ellipse {
  fill-opacity: 40%;
}
line {
  fill-opacity: 10%;
}
polyline {
  fill-opacity: 50%;
}
path {
  fill-opacity: 0.5;
}

circle,
ellipse {
  stroke: black;
  stroke-width: 3px;
}

Syntax

<'opacity'>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
1
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
the specified value converted to a <number>, clamped to the range [0,1]
Canonical order
per grammar
Animation type
by computed value

Browser support

First browser version supporting fill-opacity
Chrome 1
Edge ≤15
Firefox 1
Safari 4
Chrome Android 18
Safari iOS 3.2

First version with support, from MDN browser-compat-data.

fill-origin

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

match-parent | fill-box | stroke-box | content-box | padding-box | border-box

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
match-parent
Applies to
all elements
Inherited
no
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

fill-position

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<position>#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
0% 0%
Applies to
text and SVG shapes
Inherited
yes
Percentages
n/a
Computed value
A list, each item consisting of: a pair of offsets (horizontal and vertical) from the top left origin each given as a combination of an absolute length and a percentage
Canonical order
per grammar
Animation type
repeatable list

fill-repeat

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<repeat-style>#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
repeat
Applies to
text and SVG shapes
Inherited
yes
Percentages
n/a
Computed value
A list, each item consisting of: two keywords, one per dimension
Canonical order
per grammar
Animation type
discrete

fill-rule

Property Baseline: widely availablesince July 2022

MDN The fill-rule CSS property defines the rule used to determine which parts of the SVG shape's canvas are included inside a shape to be filled. If present, it overrides the element's fill-rule attribute.

Live preview Example from MDN
svg {
  border: 1px solid;
  height: calc(33vh - 2.5em);
  margin-bottom: 10px;
}
p {
  margin: 0;
}

svg:nth-of-type(2) > * {
  fill-rule: nonzero;
}
svg:nth-of-type(3) > * {
  fill-rule: evenodd;
}

Syntax

nonzero | evenodd

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
nonzero
Applies to
SVG shapes
Inherited
yes
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting fill-rule
Chrome 1
Edge ≤15
Firefox 3
Safari 4
Chrome Android 18
Safari iOS 3.2

First version with support, from MDN browser-compat-data.

fill-size

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<bg-size>#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
auto
Applies to
text and SVG shapes
Inherited
yes
Percentages
n/a
Computed value
as specified, but with lengths made absolute and omitted auto keywords filled in
Canonical order
per grammar
Animation type
repeatable list

stroke-align

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

center | inset | outset

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
center
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

stroke-break

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

bounding-box | slice | clone

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
bounding-box
Applies to
all elements
Inherited
?
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

stroke-color

Property Baseline: widely availablesince July 2022 Experimental

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<color>#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
transparent
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
the computed color
Canonical order
per grammar
Animation type
by computed value

Browser support

First browser version supporting stroke-color
Chrome No
Edge No
Firefox No
Safari 11.1
Chrome Android No
Safari iOS 11.3

First version with support, from MDN browser-compat-data.

stroke-dash-corner

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

none | <length>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
none
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
specified value, with lengths made absolute
Canonical order
per grammar
Animation type
by computed value if <length>, otherwise discrete

stroke-dash-justify

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

none | [ stretch | compress ] || [ dashes || gaps ]

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
none
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
specified value, with lengths made absolute
Canonical order
per grammar
Animation type
discrete

stroke-dasharray

Property Baseline: widely availablesince July 2022

MDN The stroke-dasharray CSS property defines a pattern of dashes and gaps used in the painting of the SVG shape's stroke. If present, it overrides the element's stroke-dasharray attribute.

Live preview Example from MDN
rect {
  stroke-dasharray: 10 5;
}

Syntax

none | [<length-percentage> | <number>]+#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
none
Applies to
text and SVG shapes
Inherited
yes
Percentages
relative to the scaled viewport size
Computed value
as specified
Canonical order
per grammar
Animation type
repeatable list

Browser support

First browser version supporting stroke-dasharray
Chrome 1
Edge ≤15
Firefox 1.5
Safari 4
Chrome Android 18
Safari iOS 3.2

First version with support, from MDN browser-compat-data.

stroke-dashoffset

Property Baseline: widely availablesince July 2022

MDN The stroke-dashoffset CSS property defines an offset for the starting point of the rendering of an SVG element's associated dash array. If present, it overrides the element's stroke-dashoffset attribute.

Live preview Example from MDN
path:nth-of-type(1) {
  stroke-dashoffset: 0;
}
path:nth-of-type(2) {
  stroke-dashoffset: -5;
}
path:nth-of-type(3) {
  stroke-dashoffset: 5;
}
path:nth-of-type(4) {
  stroke-dashoffset: 5px;
}
path:nth-of-type(5) {
  stroke-dashoffset: 5%;
}

Syntax

<length-percentage> | <number>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
0
Applies to
text and SVG shapes
Inherited
yes
Percentages
relative to the scaled viewport size
Computed value
as specified
Canonical order
per grammar
Animation type
repeatable list

Browser support

First browser version supporting stroke-dashoffset
Chrome 1
Edge ≤15
Firefox 1.5
Safari 4
Chrome Android 18
Safari iOS 3.2

First version with support, from MDN browser-compat-data.

stroke-image

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<paint>#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
none
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
as specified, with any <image> computed
Canonical order
per grammar
Animation type
repeatable list

stroke-linecap

Property Baseline: widely availablesince July 2022

MDN The stroke-linecap CSS property defines the shape to be used at the end of open subpaths of SVG elements' unclosed strokes. If present, it overrides the element's stroke-linecap attribute.

Live preview Example from MDN
path:nth-of-type(1) {
  stroke-linecap: butt;
}
path:nth-of-type(2) {
  stroke-linecap: square;
}
path:nth-of-type(3) {
  stroke-linecap: round;
}

Syntax

butt | round | square

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
butt
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting stroke-linecap
Chrome 1
Edge ≤15
Firefox 1.5
Safari 4
Chrome Android 18
Safari iOS 3.2

First version with support, from MDN browser-compat-data.

stroke-linejoin

Property Baseline: widely availablesince July 2022

MDN The stroke-linejoin CSS property defines the shape to be used at the corners of an SVG element's stroked paths. If present, it overrides the element's stroke-linejoin attribute.

Live preview Example from MDN
path:nth-child(1) {
  stroke-linejoin: bevel;
}
path:nth-child(2) {
  stroke-linejoin: round;
}
path:nth-child(3) {
  stroke-linejoin: miter;
}
path:nth-child(4) {
  stroke-linejoin: miter;
  stroke-miterlimit: 2;
}

Syntax

[ crop | arcs | miter ] || [ bevel | round | fallback ]

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
miter
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting stroke-linejoin
Chrome 1
Edge ≤15
Firefox 1.5
Safari 4
Chrome Android 18
Safari iOS 3.2

First version with support, from MDN browser-compat-data.

stroke-miterlimit

Property Baseline: widely availablesince July 2022

MDN The stroke-miterlimit CSS property defines a limit on the ratio of the miter length to the stroke-width when the shape to be used at the corners of an SVG element's stroked path is a mitered join. If the limit defined by this property is exceeded, the join is converted from miter to bevel, thus making the corner appear truncated.

Live preview Example from MDN
path:nth-child(1) {
  stroke-miterlimit: 1.1;
}
path:nth-child(2) {
  stroke-miterlimit: 1.4;
}
path:nth-child(3) {
  stroke-miterlimit: 1.9;
}
path:nth-child(4) {
  stroke-miterlimit: 4.2;
}
path:nth-child(5) {
  stroke-miterlimit: 6.1;
}

Syntax

<number>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
4
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
a number
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting stroke-miterlimit
Chrome 1
Edge ≤15
Firefox 1.5
Safari 4
Chrome Android 18
Safari iOS 3.2

First version with support, from MDN browser-compat-data.

stroke-opacity

Property Baseline: widely availablesince ≤ September 2022

MDN The stroke-opacity CSS property defines the opacity of an SVG shape's stroke. The effect is identical to that of , except it is applied only to the stroke, not to the entire element. If present, it overrides the element's stroke-opacity attribute.

Live preview Example from MDN
g path:nth-child(1) {
  stroke-opacity: 0.2;
} /* equiv. 20% */
g path:nth-child(2) {
  stroke-opacity: 0.4;
} /* equiv. 40% */
g path:nth-child(3) {
  stroke-opacity: 0.6;
} /* equiv. 60% */
g path:nth-child(4) {
  stroke-opacity: 0.8;
} /* equiv. 80% */
g path:nth-child(5) {
  stroke-opacity: 1;
} /* equiv. 100% */

Syntax

<'opacity'>

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
1
Applies to
text and SVG shapes
Inherited
yes
Percentages
N/A
Computed value
the specified value converted to a <number>, clamped to the range [0,1]
Canonical order
per grammar
Animation type
by computed value

Browser support

First browser version supporting stroke-opacity
Chrome 1
Edge ≤15
Firefox 1.5
Safari 4
Chrome Android 18
Safari iOS 3.2

First version with support, from MDN browser-compat-data.

stroke-origin

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

match-parent | fill-box | stroke-box | content-box | padding-box | border-box

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
match-parent
Applies to
all elements
Inherited
no
Percentages
N/A
Computed value
as specified
Canonical order
per grammar
Animation type
discrete

stroke-position

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<position>#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
0% 0%
Applies to
text and SVG shapes
Inherited
yes
Percentages
n/a
Computed value
A list, each item consisting of: a pair of offsets (horizontal and vertical) from the top left origin each given as a combination of an absolute length and a percentage
Canonical order
per grammar
Animation type
repeatable list

stroke-repeat

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<repeat-style>#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
repeat
Applies to
text and SVG shapes
Inherited
yes
Percentages
n/a
Computed value
A list, each item consisting of: two keywords, one per dimension
Canonical order
per grammar
Animation type
discrete

stroke-size

Property Not in any browser yet

No prose in the spec's definition and no MDN page yet: the spec link below is the only description.

Syntax

<bg-size>#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
auto
Applies to
text and SVG shapes
Inherited
yes
Percentages
n/a
Computed value
as specified, but with lengths made absolute and omitted auto keywords filled in
Canonical order
per grammar
Animation type
repeatable list

stroke-width

Property Baseline: widely availablesince July 2022

MDN The stroke-width CSS property defines the width of a stroke applied to the SVG shape. If present, it overrides the element's stroke-width attribute.

Live preview Example from MDN
path:nth-child(1) {
  stroke-width: 0.25;
}
path:nth-child(2) {
  stroke-width: 0.25px;
}
path:nth-child(3) {
  stroke-width: 1;
}
path:nth-child(4) {
  stroke-width: 1px;
}
path:nth-child(5) {
  stroke-width: 5%;
}

Syntax

[ <length-percentage> | <line-width> | <number> ]#

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
1px
Applies to
text and SVG shapes
Inherited
yes
Percentages
relative to the scaled viewport size
Computed value
the absolute length, or percentage
Canonical order
per grammar
Animation type
by computed value

Browser support

First browser version supporting stroke-width
Chrome 1
Edge ≤15
Firefox 1.5
Safari 4
Chrome Android 18
Safari iOS 3.2

First version with support, from MDN browser-compat-data.