<pre class='metadata'>
Title: CSS Backgrounds and Borders Module Level 3
Status: ED
Implementation Report: https://wpt.fyi/results/css/css-backgrounds
Work Status: Testing
Shortname: css-backgrounds
Level: 3
Group: csswg
ED: https://drafts.csswg.org/css-backgrounds/
TR: https://www.w3.org/TR/css-backgrounds-3/
Previous Version: https://www.w3.org/TR/2024/CRD-css-backgrounds-3-20240311/
Previous Version: https://www.w3.org/TR/2020/CR-css-backgrounds-3-20201222/
Previous Version: https://www.w3.org/TR/2017/CR-css-backgrounds-3-20171017/
Previous version: https://www.w3.org/TR/2014/CR-css3-background-20140909/
Former Editor: Bert Bos, W3C, bert@w3.org, w3cid 3343
Editor: Elika J. Etemad / fantasai, Apple, http://fantasai.inkedblade.net/contact, w3cid 35400
Editor: Brad Kemper, Invited Expert, brad.kemper@gmail.com, w3cid 43245
Abstract: This draft contains the features of CSS relating to borders and backgrounds. The main extensions compared to <a href="https://www.w3.org/TR/CSS2/">level&nbsp;2</a> are borders consisting of images, boxes with multiple backgrounds, boxes with rounded corners and boxes with shadows.
WPT Path Prefix: css/css-backgrounds/
WPT Display: closed
At risk: animatability of 'box-shadow'
At risk: applicability of 'border' and its longhands to [=ruby base containers=] and [=ruby annotation containers=]
Ignored Vars: width of background positioning area, width of background image, height of background positioning area, height of background image, X, X', Li, Ltop, Lbottom, Lleft, Lright, spread, Wside, Wleft, Wright, Wtop, Wbottom, spread distance
</pre>
<pre class="link-defaults">
spec:css-break-4; type:dfn; text:fragment
spec:css-color-4;
	type:property; text:color
	type:value; text:transparent
spec:css-sizing-3; type:dfn;
	text:size
	text:width
	text:height
spec:css-values-3; type:type; text:<position>
spec:css2;
	type:dfn; text:viewport
	type:property;
		text:display
		text:overflow
	type:type; text:<uri>
	type:value;
		text:table
		text:inline-table
		text:table-cell
		for:overflow; text:visible
spec:selectors-3; type:selector;
	text: ::first-letter
	text: ::first-line
spec:html; type:element; text:body
</pre>

<h2 id="introduction">Introduction</h2>

	<em>This subsection is not normative.</em>

	When elements are rendered according to the
	<a href="https://www.w3.org/TR/css-box-3/#box-model">CSS box model</a> [[!CSS-BOX-3]],
	each element is either not displayed at all,
	or formatted as one or more rectangular boxes.
	Each box has a rectangular [=content area=],
	a band of [=padding=] around the content,
	a [=border=] around the padding,
	and a [=margin=] outside the border.
	(The margin may actually be negative,
	  but margins have no influence on the background and border.)

	<figure>
		<img src="images/box.png" width="458" height="278"
		     alt="Diagram of a typical box, showing the content, padding, border and margin areas"
		>

		<figcaption>
			The various areas and edges of a typical box.
			(This diagram is explained in the CSS Box Model Module [[!CSS-BOX-3]].)
		</figcaption>
	</figure>

	The properties of this module deal with the decoration of the [=border area=]
	and with the background of the [=content area|content=], [=padding area|padding=], and [=border area|border=] areas.
	Additionally the box may be given a “drop-shadow” effect
	with the 'box-shadow' property.

	If an element is broken into multiple [=box fragments=],
	'box-decoration-break' [[CSS-BREAK-3]] defines
	how the borders and background are divided over the various fragments.
	(An element can result in more than one fragment if it is broken
	at the end of a line, at the end of a column or at the end of a page;
	and continued in the next line, column or page.)

	The relative stacking order of backgrounds, borders, and shadows
	is given in this module.
	For how these layers interact with other rendered content,
	see Appendix E “Elaborate description of Stacking Contexts” in [[!CSS2]].

<h3 id="placement">
Module Interactions</h3>

	This module replaces and extends the background and border features
	defined in [[!CSS2]] sections 8.5 and 14.2.

	All properties in this module apply to the ''::first-letter'' [=pseudo-element=].
	The <a href="#backgrounds">background properties</a>
	and <a href="#corners">border-radius properties</a> also apply
	to the ''::first-line'' [=pseudo-element=].
	The UA may (but is not required to)
	apply the 'border-image' or 'box-shadow' properties to ''::first-line''.
	The UA must not
	apply the <a href="#borders">border-color/style/width properties</a>
	to ''::first-line''.
	[[!CSS2]]

<h3 id="values">
Value Definitions</h3>

	This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS2]]
	using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from [[!CSS-VALUES-3]].
	Value types not defined in this specification are defined in CSS Values &amp; Units [[!CSS-VALUES-3]].
	Combination with other CSS modules may expand the definitions of these value types.
	For example, combining with <a href="https://www.w3.org/TR/css-images/">CSS Images</a>
	allows for using CSS gradients as 'background-image' or 'border-image' values.
	[[CSS-IMAGES-3]]

	In addition to the property-specific values listed in their definitions,
	all properties defined in this specification
	also accept the <a>CSS-wide keywords</a> as their property value.
	For readability they have not been repeated explicitly.

<h2 id="backgrounds">
Backgrounds</h2>

	Each box has a background layer that may be fully transparent (the default),
	or filled with a color and/or one or more images.
	The background properties specify what color ('background-color')
	and images ('background-image') to use,
	and how they are sized, positioned, tiled, etc.

	The background properties are not inherited,
	but the parent box's background will shine through by default
	because of the initial ''transparent'' value on 'background-color'.

<h3 id="layering">
Layering Multiple Background Images</h3>

	The background of a box can have multiple
	<dfn export lt="background image layer" local-lt="layer">background image layers</dfn>.
	The number of layers is determined by
	the number of comma-separated values in the 'background-image' property.
	Note that a value of ''background-image/none'' still creates a layer.

	<wpt>
		background-none-none-and-color.html
		order-of-images.htm
		scroll-positioned-multiple-background-images.html
	</wpt>

	Each of the [=background images=] is sized, positioned, and tiled
	according to the corresponding value in the other background properties.
	The lists are matched up from the first value:
	excess values at the end are not used.
	If a property doesn't have enough comma-separated values
	to match the number of layers,
	the [=UA=] must calculate its [=used value=]
	by repeating the list of values until there are enough.

	<div class="example">
		For example, this set of declarations:

		<pre>
		background-image: url(flower.png), url(ball.png), url(grass.png);
		background-position: center center, 20% 80%, top left, bottom right;
		background-origin: border-box, content-box;
		background-repeat: no-repeat;
		</pre>

		has exactly the same effect as this set,
		with the extra position dropped
		and the missing values for 'background-origin' and 'background-repeat'
		filled in (emphasized for clarity):

		<pre>
		background-image: url(flower.png), url(ball.png), url(grass.png);
		background-position: center center, 20% 80%, top left;
		background-origin: border-box, content-box<strong>, border-box</strong>;
		background-repeat: no-repeat<strong>, no-repeat, no-repeat</strong>;
		</pre>
	</div>

	The first image in the list is the [=layer=] closest to the user,
	the next one is painted behind the first, and so on.
	The background color, if present,
	is painted below all of the other [=layers=].

	Note: The <a href="#border-images">border-image properties</a>
	can also define a background image,
	which, if present, is painted on top of
	the background [=layers=] created by the background properties.

<h3 id="background-color" oldids="the-background-color">
Base Color: the 'background-color' property</h3>

	<pre class="propdef">
	Name: background-color
	Value: <<color>>
	Initial: transparent
	Applies to: all elements
	Inherited: no
	Percentages: N/A
	Computed value: computed color
	Animation type: by computed value
	</pre>

	<wpt>
		animations/background-color-animation-backdrop-infinite-duration-crash.html
		animations/background-color-animation-element-not-visible-at-current-viewport.html
		animations/background-color-animation-fallback-additive-keyframe.html
		animations/background-color-animation-fallback-missing-0-percent.html
		animations/background-color-animation-fallback-missing-100-percent.html
		animations/background-color-animation-fallback-replace.html
		animations/background-color-animation-field-crash.html
		animations/background-color-animation-fragmented.html
		animations/background-color-animation-half-opaque.html
		animations/background-color-animation-in-body.html
		animations/background-color-animation-non-empty-no-draw-crash.html
		animations/background-color-animation-non-zero-size-element-change-to-zero.html
		animations/background-color-animation-pseudo-element.html
		animations/background-color-animation-removed-element-crash.html
		animations/background-color-animation-single-keyframe.html
		animations/background-color-animation-three-keyframes1.html
		animations/background-color-animation-three-keyframes2.html
		animations/background-color-animation-three-keyframes3.html
		animations/background-color-animation-will-change-contents.html
		animations/background-color-animation-with-blur.html
		animations/background-color-animation-with-images.html
		animations/background-color-animation-with-mask.html
		animations/background-color-animation-with-table1.html
		animations/background-color-animation-with-table2.html
		animations/background-color-animation-with-table3.html
		animations/background-color-animation-with-table4.html
		animations/background-color-animation-with-zero-playbackRate.html
		animations/background-color-animation-zero-size-element-change-to-non-zero.html
		animations/background-color-animation-zero-size-element.html
		animations/background-color-animation.html
		animations/background-color-interpolation.html
		animations/background-color-scroll-into-viewport.html
		animations/background-color-transition-colormix.html
		animations/background-color-transition-currentcolor.html
		animations/background-color-transition.html
		animations/background-color-transparent-animation-in-body.html
		animations/invalidation/background-color-animation-with-zero-alpha.html
		animations/invalidation/background-color-transition-obscured.html
		animations/invalidation/background-color-transition-with-delay.html
		animations/invalidation/background-color-transition-with-initially-transparent.html
		animations/two-background-color-animation-diff-length1.html
		animations/two-background-color-animation-diff-length2.html
		animations/two-background-color-animation-diff-length3.html
		background-none-none-and-color.html
		background-color-body-propagation-001.html
		background-color-body-propagation-002.html
		background-color-body-propagation-003.html
		background-color-body-propagation-004.html
		background-color-body-propagation-005.html
		background-color-body-propagation-006.html
		background-color-body-propagation-007.html
		background-color-body-propagation-008.html
		background-color-body-propagation-009.html
		background-color-clip.html
		background-color-root-propagation-001.html
		background-color-root-propagation-002.html
		bg-color-with-gradient.html
		child-move-reveals-parent-background.html
		color-mix-currentcolor-background-repaint-parent.html
		color-mix-currentcolor-background-repaint.html
		hidpi/simple-bg-color.html
		inheritance.sub.html
		inline-background-rtl-001.html
		parsing/background-color-computed.html
		parsing/background-color-invalid.html
		parsing/background-color-valid.html
		color-behind-images.htm
	</wpt>

	This property sets the <dfn export id="background-color-layer">background color</dfn> of a box.
	This color is drawn behind any background images.

	<div class="example">
		Example:
		<pre>h1 { background-color: #F00 } /* Sets background to red. */</pre>
	</div>

	The [=background color=] is clipped
	according to the 'background-clip' value
	associated with the bottom-most [=background image layer=].

<h3 id="background-image" oldids="the-background-image">
Image Sources: the 'background-image' property</h3>

	<pre class="propdef">
	Name: background-image
	Value: <<bg-image>>#
	Initial: none
	Applies to: all elements
	Inherited: no
	Percentages: N/A
	Computed value: list, each item either an <<image>> or the keyword ''background-image/none''
	Animation type: discrete
	</pre>

	<wpt>
		background-image-001.html
		background-image-002.html
		background-image-003.html
		background-image-004.html
		background-image-005.html
		background-image-006.html
		background-image-007.html
		background-image-centered-with-border-radius.html
		background-image-centered.html
		background-image-cors-no-reload.html
		background-image-cover-zoomed-1.html
		background-image-first-letter.html
		background-image-first-line.html
		background-image-gradient-currentcolor-conic-repaint.html
		background-image-gradient-currentcolor-linear-repaint.html
		background-image-gradient-currentcolor-radial-repaint.html
		background-image-gradient-currentcolor-visited.html
		background-image-gradient-interpolation-repaint.html
		background-image-large-with-auto.html
		background-image-none-gradient-repaint.html
		background-image-shared-stylesheet.html
		background-image-table-cells-straddling-no-repeat.html
		background-image-table-cells-zoomed.html
		background-image-with-border-radius-fidelity.html
		animations/background-image-interpolation.html
		inheritance.sub.html
		parsing/background-image-computed.sub.html
		parsing/background-image-invalid.html
		parsing/background-image-valid.html
	</wpt>

	This property specifies the <dfn export lt="background image" local-lt="image" id="background-images">background image(s)</dfn> of an element.
	Images are drawn with the first specified one on top (closest to the user)
	and each subsequent image behind the previous one.
	The property's value is given as a comma-separated list
	of <<bg-image>> values where

	<pre class=prod><dfn><<bg-image>></dfn> = <<image>> | none</pre>

	A value of <dfn value for="background-image">none</dfn>
	counts as a [=background image layer=] but draws nothing.
	An image that is empty (zero width or zero height),
	that fails to download,
	or that cannot be displayed
	(e.g., because it is not in a supported image format)
	likewise counts as a [=layer=] but draws nothing.

	See [[#layering]] for how 'background-image' interacts
	with other comma-separated background properties
	to form each [=background image layer=].

	When setting a background image,
	authors should also specify a 'background-color'
	that will preserve contrast with the text
	for when the image is unavailable.

	For accessibility reasons,
	authors should not use background images
	as the sole method of conveying important information.
	See <a href="https://www.w3.org/TR/2008/NOTE-WCAG20-TECHS-20081211/F3">Web Content Accessibility Guideline F3</a> [[WCAG20]].
	Images are not accessible in non-graphical presentations,
	and background images specifically
	might be turned off in high-contrast display modes.

	Note: Stylistic foreground images can be provided in CSS
	with the 'content' property.
	Semantically-important foreground images should be provided
	in the document markup, e.g. with the &lt;img&gt; tag in HTML.

	Note: <a href="https://www.w3.org/TR/media-frags/#naming-space">Media fragments</a>
	can be used to display a portion of an image.
	The <a href="https://www.w3.org/TR/css-images/">CSS Images</a> module
	will provide fallback syntax for image formats
	and include additional controls for image display.

	<div class="example">
		Some examples specifying background images:

		<pre>
		html { background-image: url("marble.svg") }
		p { background-image: none }
		div { background-image: url(tl.png), url(tr.png) }
		main { background-image: radial-gradient(at bottom right, transparent, white); }
		</pre>
	</div>

	Implementations may optimize
	by not downloading and drawing images that are not visible
	(e.g., because they are behind other, fully opaque images).

<h3 id="background-repeat" oldids="the-background-repeat">
Tiling Images: the 'background-repeat' property</h3>

	<pre class="propdef">
	Name: background-repeat
	Value: <<repeat-style>>#
	Initial: repeat
	Applies to: all elements
	Inherited: no
	Percentages: N/A
	Computed value: list, each item a pair of keywords, one per dimension
	Animation type: discrete
	</pre>

	<wpt>
		animations/discrete-no-interpolation.html
		background-repeat-round-1a.html
		background-repeat-round-1b.html
		background-repeat-round-1c.html
		background-repeat-round-1d.html
		background-repeat-round-1e.html
		background-repeat-round-2.html
		background-repeat-round-3.html
		background-repeat-round-4.html
		background-repeat-space-10.html
		background-repeat-space-1a.html
		background-repeat-space-1b.html
		background-repeat-space-1c.html
		background-repeat-space-2.html
		background-repeat-space-3.html
		background-repeat-space-4.html
		background-repeat-space-5.html
		background-repeat-space-6.html
		background-repeat-space-7.html
		background-repeat-space-8.html
		background-repeat-space-9.html
		background-repeat/background-repeat-no-repeat.xht
		background-repeat/background-repeat-repeat-x.xht
		background-repeat/background-repeat-repeat-y.xht
		background-repeat/background-repeat-round-roundup.xht
		background-repeat/background-repeat-round.xht
		background-repeat/background-repeat-space.xht
		background-repeat/gradient-repeat-spaced-with-borders.html
		inheritance.sub.html
		parsing/background-repeat-computed.html
		parsing/background-repeat-invalid.html
		parsing/background-repeat-valid.html
		subpixel-repeat-no-repeat-mix.html
	</wpt>

	This property specifies how [=background images=] are tiled
	after they have been [[#background-size|sized]]
	and [[#background-position|positioned]].
	The property's value is given as a comma-separated list
	of <<repeat-style>> values where

	<pre class=prod><dfn><<repeat-style>></dfn> = repeat-x | repeat-y | [repeat | space | round | no-repeat]{1,2}</pre>

	Single values for <<repeat-style>> have the following meanings:

	<dl dfn-type=value dfn-for=background-repeat>
		<dt><dfn>repeat-x</dfn>
		<dd>
			Computes to ''repeat no-repeat''.

		<dt><dfn>repeat-y</dfn>
		<dd>
			Computes to ''no-repeat repeat''.

		<dt>''background-repeat/repeat''
		<dd>
			Computes to ''repeat repeat''.

		<dt>''background-repeat/space''
		<dd>
			Computes to ''space space''

		<dt>''background-repeat/round''
		<dd>
			Computes to ''round round''

		<dt>''no-repeat''
		<dd>
			Computes to ''no-repeat no-repeat''
	</dl>

	If a <<repeat-style>> value has two keywords,
	the first one applies to the horizontal axis,
	the second to the vertical one,
	as follows:

	<dl dfn-for=background-repeat dfn-type=value>
		<dt><dfn>repeat</dfn>
		<dd>
			The [=image=] is repeated in this direction as often as needed
			to cover the [=background painting area=].

		<dt><dfn>space</dfn>
		<dd>
			The [=image=] is repeated as often as will fit
			within the [=background positioning area=] without being clipped,
			and then the images are spaced out to fill the area.
			The first and last images touch the edges of the area.
			If the [=background painting area=] is larger
			than the [=background positioning area=],
			then the pattern repeats to fill the background painting area.
			The value of 'background-position' for this direction is ignored
			unless there is not enough space
			for two copies of the image in this axis,
			in which case only one image is placed,
			and 'background-position' determines its position in this axis.

		<dt><dfn>round</dfn>
		<dd>
			The [=image=] is repeated as often as will fit within the
			[=background positioning area=]. If it doesn't
			fit a whole number of times, it is rescaled so that it does.
			See the formula under 'background-size'.
			If the [=background painting area=] is larger than the background positioning area, then
			the pattern repeats to fill the background painting area.

		<dt><dfn>no-repeat</dfn>
		<dd>
			The [=image=] is placed once and not repeated in this direction.
	</dl>

	Unless one of the two keywords is ''no-repeat'',
	the whole [=background painting area=] will be tiled,
	i.e., not just one vertical strip and one horizontal strip.

	<div class="example">
		<pre>
		body {
		  background: white url("pendant.png");
		  background-repeat: repeat-y;
		  background-position: center;
		}
		</pre>

		<figure>
			<img src="images/bg-repeat.png" width="243" height="334"
			     alt="A centered background image, with copies repeated up and down the border, padding, and content areas."
			>

			<figcaption>
				The effect of ''repeat-y'':
				One copy of the background image is centered,
				and other copies are put above and below it
				to make a vertical band behind the element.
			</figcaption>
		</figure>
	</div>

	<div class=example>
		<pre>
		body {
		  background-image: url(dot.png) white;
		  background-repeat: space
		}
		</pre>

		<figure>
			<img src="images/bg-space.png" width="250" height="365"
			     alt="Image of an element with a dotted background"
			>

			<figcaption>
				The effect of ''background-repeat/space'':
				the image of a dot is tiled to cover the whole background
				and the images are equally spaced.
			</figcaption>
		</figure>
	</div>

	See [[#layering]] for how 'background-repeat' interacts
	with other comma-separated background properties
	to form each [=background image layer=].


<h3 id="background-attachment" oldids="the-background-attachment">
Affixing Images: the 'background-attachment' property</h3>

	<pre class="propdef">
	Name: background-attachment
	Value: <<attachment>>#
	Initial: scroll
	Applies to: all elements
	Inherited: no
	Percentages: N/A
	Computed value: list, each item the keyword as specified
	Animation type: discrete
	</pre>

	<wpt>
		animations/discrete-no-interpolation.html
		background-attachment-350.html
		background-attachment-353.html
		background-attachment-fixed-block-002.html
		background-attachment-fixed-border-radius-offset.html
		background-attachment-fixed-inline-002.html
		background-attachment-fixed-inline-scrolled.html
		background-attachment-fixed-inside-transform-1.html
		background-attachment-local-block-002.html
		background-attachment-local-hidden.html
		background-attachment-local/attachment-local-clipping-color-1.html
		background-attachment-local/attachment-local-clipping-color-2.html
		background-attachment-local/attachment-local-clipping-color-3.html
		background-attachment-local/attachment-local-clipping-color-4.html
		background-attachment-local/attachment-local-clipping-color-5.html
		background-attachment-local/attachment-local-clipping-color-6.html
		background-attachment-local/attachment-local-clipping-image-1.html
		background-attachment-local/attachment-local-clipping-image-2.html
		background-attachment-local/attachment-local-clipping-image-3.html
		background-attachment-local/attachment-local-clipping-image-4.html
		background-attachment-local/attachment-local-clipping-image-5.html
		background-attachment-local/attachment-local-clipping-image-6.html
		background-attachment-local/attachment-local-positioning-2.html
		background-attachment-local/attachment-local-positioning-3.html
		background-attachment-local/attachment-local-positioning-4.html
		background-attachment-local/attachment-local-positioning-5.html
		background-attachment-local/attachment-scroll-positioning-1.html
		background-attachment-margin-root-001.html
		background-attachment-margin-root-002.html
		inheritance.sub.html
		local-attachment-content-box-scroll.html
		parsing/background-attachment-computed.html
		parsing/background-attachment-invalid.html
		parsing/background-attachment-valid.html
	</wpt>

	If [=background images=] are specified,
	this property specifies whether they are
	fixed with regard to the [=viewport=] (''fixed'')
	or scroll along with the box (''scroll'')
	or its contents (''local'').
	The property's value is given as a comma-separated list
	of <<attachment>> keywords where

	<pre class=prod><dfn><<attachment>></dfn> = scroll | fixed | local</pre>

	<dl dfn-for=background-attachment dfn-type=value>
		<dt><dfn>fixed</dfn></dt>
			<dd>
			The background is fixed with regard to the viewport.
			In [=paged media=] where there is no viewport,
			a ''fixed'' background is fixed with respect to
			the <a href="https://www.w3.org/TR/CSS2/page.html#page-box">page box</a>
			and therefore replicated on every page.

			Note: There is only one viewport per view.
			Even if an box is a [=scroll container=],
			a ''fixed'' background doesn't move with the box.

		<dt><dfn>local</dfn></dt>
			<dd>
				The background is fixed with regard to the box's contents:
				if the box has a scrolling mechanism,
				the background scrolls with the box's contents,
				and the [=background painting area=] and [=background positioning area=]
				are relative to the [=scrollable overflow area=] of the box
				rather than to the border framing them.
				Because the [=scrollable overflow area=]
				does not include the [=border area=],
				for [=scroll containers=] the ''background-clip/border-box'' value of 'background-clip'
				may be treated the same as ''background-clip/padding-box''.

		<dt><dfn>scroll</dfn></dt>
			<dd>
				The background is fixed with regard to the box itself
				and does not scroll with its contents.
				(It is effectively attached to the box's border.)
	</dl>

	Even if the image is fixed,
	it is still only visible when it is in the [=background painting area=] of the box
	or otherwise unclipped.
	(See [[#special-backgrounds]] for the cases when
	background images are not clipped.)
	Thus, unless the image is tiled, it may be invisible.

	<div class="example">
		This example creates an infinite vertical band
		that remains “glued” to the viewport when the document is scrolled.

		<pre>
		body {
		  background: red url("pendant.gif");
		  background-repeat: repeat-y;
		  background-attachment: fixed;
		}
		</pre>
	</div>

	Note: User agents that do not support ''fixed'' backgrounds
	(for example due to limitations of the hardware platform)
	<a href="https://www.w3.org/TR/CSS/#partial">will ignore declarations</a>
	with the keyword ''fixed''.
	For example:

	<pre class=example>
	body {
	  /* For all UAs: */
	  background: white url(paper.png) scroll;
	  /* For UAs that do fixed backgrounds: */
	  background: white url(ledger.png) fixed;
	}
	h1 {
	  /* For all UAs: */
	  background: silver;
	  /* For UAs that do fixed backgrounds: */
	  background: url(stripe.png) fixed, white url(ledger.png) fixed;
	}
	</pre>

	See [[#layering]] for how 'background-attachment' interacts
	with other comma-separated background properties
	to form each [=background image layer=].

<h3 id="background-position" oldids="the-background-position">Positioning Images: the 'background-position' property</h3>

	<pre class="propdef">
	Name: background-position
	Value: <<bg-position>>#
	Initial: 0% 0%
	Applies to: all elements
	Inherited: no
	Percentages: refer to size of [=background positioning area=]
	    <em>minus</em> size of background image; see text
	Computed value: list,
	    each item a pair of offsets (horizontal and vertical) from the top left origin
	    each given as a computed <<length-percentage>> value
	Animation type: repeatable list
	</pre>

	<wpt>
		animations/background-position-composition.html
		animations/background-position-interpolation.html
		background-position-calc-minmax-001.html
		background-position-negative-percentage-comparison-002.html
		background-position-negative-percentage-comparison.html
		background-position-three-four-values.html
		background-position/background-position-bottom-right-repeat-round.html
		background-position/background-position-right-in-body.html
		inheritance.sub.html
		parsing/background-position-computed.html
		parsing/background-position-invalid.html
		parsing/background-position-valid.html
	</wpt>

	If [=background images=] have been specified,
	this property specifies their initial position
	(after any <a href="#background-size">resizing</a>)
	within their corresponding [=background positioning area=].

	The property's value is given as a comma-separated list
	of <<bg-position>> values where

	<pre class=prod>
	<dfn><<bg-position>></dfn> = [
	  [ left | center | right | top | bottom | <<length-percentage>> ]
	|
	  [ left | center | right | <<length-percentage>> ]
	  [ top | center | bottom | <<length-percentage>> ]
	|
	  [ center | [ left | right ] <<length-percentage>>? ] &amp;&amp;
	  [ center | [ top | bottom ] <<length-percentage>>? ]
	]
	</pre>

	If only one value is specified,
	the second value is assumed to be ''center''.
	If two values are given,
	a <<length-percentage>> as the first value represents
	the horizontal position (or offset)
	and a <<length-percentage>> as the second value represents
	the vertical position (or offset).
	The <<length-percentage>> values here represent
	an offset of the top left corner of the background image
	from the top left corner of the [=background positioning area=].

	Note: A pair of keywords can be reordered,
	while a combination of keyword and length or percentage cannot.
	So ''center left'' is valid while ''50% left'' is not.

	If three or four values are given,
	then each <<length-percentage>> represents an offset
	and must be preceded by a keyword,
	which specifies from which edge the offset is given.
	For example, ''background-position: bottom 10px right 20px''
	represents a ''10px'' vertical offset up from the bottom edge
	and a ''20px'' horizontal offset leftward from the right edge.
	If three values are given,
	the missing offset is assumed to be zero.

	Positive values represent an offset <em>inward</em>
	from the edge of the [=background positioning area=].
	Negative values represent an offset <em>outward</em>
	from the edge of the [=background positioning area=].

	<div class="example">
		The following declarations give the stated (horizontal, vertical)
		offsets from the top left corner:
		<pre>
		background-position: left 10px top 15px;   /* 10px, 15px */
		background-position: left      top     ;   /*  0px,  0px */
		background-position:      10px     15px;   /* 10px, 15px */
		background-position: left          15px;   /*  0px, 15px */
		background-position:      10px top     ;   /* 10px,  0px */
		background-position: left      top 15px;   /*  0px, 15px */
		background-position: left 10px top     ;   /* 10px,  0px */
		</pre>
	</div>

	<dl dfn-for=background-position dfn-type=value>
		<dt><dfn><<percentage>></dfn>
		<dd>
			A percentage for the horizontal offset is relative to
			(<var>width of [=background positioning area=]</var> - <var>width of [=background image=]</var>).
			A percentage for the vertical offset is relative to
			(<var>height of [=background positioning area=]</var> - <var>height of [=background image=]</var>),
			where the size of the image is the size given by 'background-size'.

			<div class=example>
				For example, with a value pair of ''0% 0%'',
				the upper left corner of the image is aligned with
				the upper left corner of, usually, the box's [=padding edge=].
				A value pair of ''100% 100%'' places
				the lower right corner of the image
				in the lower right corner of the area.
				With a value pair of ''75% 50%'',
				the point 75% across and 50% down the image
				is to be placed at the point 75% across and 50% down the area.

				<figure>
					<img src="images/bg-pos.png" width="397" height="269"
					     alt="Diagram of image position within element"
					>
					<figcaption>
						Diagram of the meaning of ''background-position: 75% 50%''.
					</figcaption>
				</figure>
			</div>

		<dt><dfn><<length>></dfn>
		<dd>
			A length value gives a fixed length as the offset.
			For example, with a value pair of ''2cm 1cm'',
			the upper left corner of the image is placed
			2cm to the right and 1cm below
			the upper left corner of the [=background positioning area=].

		<dt><dfn>''top''</dfn>
		<dd>
			Computes to ''0%'' for the vertical position if one or two values are given,
			otherwise specifies the top edge as the origin for the next offset.

		<dt><dfn>''right''</dfn>
		<dd>
			Computes to ''100%'' for the horizontal position if one or two values are given,
			otherwise specifies the right edge as the origin for the next offset.

		<dt><dfn>''bottom''</dfn>
		<dd>
			Computes to ''100%'' for the vertical position if one or two values are given,
			otherwise specifies the bottom edge as the origin for the next offset.

		<dt><dfn>''left''</dfn>
		<dd>
			Computes to ''0%'' for the horizontal position if one or two values are given,
			otherwise specifies the left edge as the origin for the next offset.

		<dt><dfn>''center''</dfn>
		<dd>
			Computes to ''50%'' (''left 50%'') for the horizontal position
			if the horizontal position is not otherwise specified,
			or ''50%'' (''top 50%'') for the vertical position if it is.
	</dl>

	<div class="example">
		The following 'background' shorthand declarations use keywords
		to set 'background-position' to the stated percentage values.
		<pre>
		body { background: url("banner.jpeg") right top }    /* 100%   0% */
		body { background: url("banner.jpeg") top center }   /*  50%   0% */
		body { background: url("banner.jpeg") center }       /*  50%  50% */
		body { background: url("banner.jpeg") bottom }       /*  50% 100% */
		</pre>
	</div>

	<div class="example">
		In the example below, the (single) image is placed
		in the lower-right corner of the viewport.
		<pre>
		body {
		  background-image: url("logo.png");
		  background-attachment: fixed;
		  background-position: 100% 100%;
		  background-repeat: no-repeat;
		}
		</pre>
	</div>

	<div class=example>
		Background positions can also be relative to other corners than the top left.
		For example, the following puts the background image
		10px from the bottom and 3em from the right:

		<pre>background-position: right 3em bottom 10px</pre>
	</div>

	See [[#layering]] for how 'background-position' interacts
	with other comma-separated background properties
	to form each [=background image layer=].

<h4 id="bg-position-serialization">
Serialization of 'background-position' values</h4>

	The [=specified value=] and [=computed value=] of the <<bg-position>> type
	serialize exactly as defined in [[CSS-VALUES-4]] for <<position>>.
	For 3-value productions
	(which are not valid in <<position>>),
	the [=specified value=] serialization
	is identical to the equivalent 4-value syntax
	except that the omitted offset remains omitted.

<h3 id="background-clip" oldids="the-background-clip">
Painting Area: the 'background-clip' property</h3>

	<pre class="propdef">
	Name: background-clip
	Value: <<visual-box>>#
	Initial: border-box
	Applies to: all elements
	Inherited: no
	Percentages: N/A
	Computed value: list, each item a keyword as specified
	Animation type: repeatable list
	</pre>

	<wpt>
		animations/discrete-no-interpolation.html
		background-clip-001.html
		background-clip-002.html
		background-clip-003.html
		background-clip-004.html
		background-clip-005.html
		background-clip-006.html
		background-clip-007.html
		background-clip-008.html
		background-clip-009.html
		background-clip-010.html
		background-clip-color-repaint.html
		background-clip-color.html
		background-clip-content-box-001.html
		background-clip-content-box-002.html
		background-clip-content-box-with-border-radius-002.html
		background-clip-content-box-with-border-radius-003.html
		background-clip-padding-box-with-border-radius-002.html
		background-clip-padding-box-with-border-radius-003.html
		background-clip-padding-box-001.html
		background-clip-padding-box-with-border-radius.html
		background-clip/clip-border-area-background-geometry.html
		background-clip/clip-border-area-border-image.html
		background-clip/clip-border-area-border-on-top.html
		background-clip/clip-border-area-box-decoration-break.html
		background-clip/clip-border-area-multiple-backgrounds.html
		background-clip/clip-border-area-on-body-not-propagated-to-root.html
		background-clip/clip-border-area-on-body-propagated-to-root.html
		background-clip/clip-border-area-on-root.html
		background-clip/clip-border-area.html
		background-clip/clip-text-ellipsis.html
		background-clip/clip-text-on-body-not-propagated-to-root.html
		background-clip/clip-text-on-body-propagated-to-root.html
		background-clip/clip-text-on-root.html
		background-clip/clip-text-out-of-flow-child.html
		background-clip/clip-text-text-decorations.html
		background-clip/clip-text-text-emphasis.html
		background-clip/clip-rounded-corner.html
		background-clip/clip-text-animated-text.html
		background-clip/clip-text-dynamic-2.html
		background-clip/clip-text-flex.html
		background-clip/clip-text-multi-line.html
		background-clip_padding-box.html
		background-paint-order-001.html
		background-rounded-image-clip-001.html
		background-rounded-image-clip-002.html
		css3-background-clip-border-box.html
		css3-background-clip-content-box.html
		css3-background-clip-padding-box.html
		css3-background-clip.html
		inheritance.sub.html
		local-attachment-content-box-scroll.html
		parsing/background-clip-computed.html
		parsing/background-clip-invalid.html
		parsing/background-clip-valid.html
	</wpt>

	Determines the <dfn export>background painting area</dfn>,
	which determines the area within which the background is painted.
	Values have the following meanings:

	<dl dfn-for=background-clip dfn-type=value>
		<dt><dfn>border-box</dfn></dt>
		<dd>
			The background is painted within (clipped to) the
			[=border box=].
		<dt><dfn>padding-box</dfn></dt>
		<dd>
			The background is painted within (clipped to) the
			[=padding box=].
		<dt><dfn>content-box</dfn></dt>
		<dd>
			The background is painted within (clipped to) the
			[=content box=].
	</dl>

	Note: The root element has a different [=background painting area=]
	and thus the 'background-clip' property has no effect when specified on it.
	See [[#special-backgrounds]].

	Note: The background is always drawn <em>behind</em> the border, if any.
	See “Elaborate description of Stacking Contexts” in [[!CSS2]] Appendix E.

	See [[#corner-shaping]] for how 'border-radius' affects
	the shape of the [=background painting area=].

	See [[#layering]] for how 'background-clip' interacts
	with other comma-separated background properties
	to form each [=background image layer=].


<h3 id="background-origin" oldids="the-background-origin">
Positioning Area: the 'background-origin' property</h3>

	<pre class="propdef">
	Name: background-origin
	Value: <<visual-box>>#
	Initial: padding-box
	Applies to: all elements
	Inherited: no
	Percentages: N/A
	Computed value: list, each item a keyword as specified
	Animation type: repeatable list
	</pre>

	<wpt>
		animations/discrete-no-interpolation.html
		animations/background-position-origin-interpolation.html
		background-gradient-subpixel-fills-area.html
		background-origin-001.html
		background-origin-002.html
		background-origin-003.html
		background-origin-004.html
		background-origin-005.html
		background-origin-006.html
		background-origin-007.html
		background-origin-008.html
		background-origin/origin-border-box.html
		background-origin/origin-border-box_with_position.html
		background-origin/origin-border-box_with_radius.html
		background-origin/origin-border-box_with_size.html
		background-origin/origin-content-box.html
		background-origin/origin-content-box_with_position.html
		background-origin/origin-content-box_with_radius.html
		background-origin/origin-content-box_with_size.html
		background-origin/origin-padding-box.html
		background-origin/origin-padding-box_with_position.html
		background-origin/origin-padding-box_with_radius.html
		background-origin/origin-padding-box_with_size.html
		css3-background-origin-border-box.html
		css3-background-origin-content-box.html
		css3-background-origin-padding-box.html
		inheritance.sub.html
		parsing/background-origin-computed.html
		parsing/background-origin-invalid.html
		parsing/background-origin-valid.html
	</wpt>


	This property determines the <dfn export>background positioning area</dfn>:
	the area within which any background images are positioned.
	For elements rendered as multiple [=box fragments=]
	(e.g., inline boxes on several lines, boxes on several pages),
	specifies which boxes 'box-decoration-break' [[CSS-BREAK-3]] operates on
	to determine the background positioning area(s).

	<dl dfn-for=background-origin dfn-type=value>
		<dt><dfn>padding-box</dfn>
		<dd>
			The position is relative to the [=padding box=].
			(For single boxes ''0 0'' is the upper left corner of the padding edge,
			''100% 100%'' is the lower right corner.)
		<dt><dfn>border-box</dfn>
		<dd>
			The position is relative to the [=border box=].
		<dt><dfn>content-box</dfn>
		<dd>
			The position is relative to the [=content box=].
	</dl>

	If the 'background-attachment' value for this [=layer=] is ''fixed'',
	then this property has no effect:
	in this case the [=background positioning area=] is
	the [=initial containing block=].

	Note: If 'background-clip' is ''background-clip/padding-box'',
	'background-origin' is ''background-origin/border-box'',
	'background-position' is ''top left'' (the initial value),
	and the element has a non-zero border,
	then the top and left edges of the [=background image=] will be clipped.

	See [[#layering]] for how 'background-origin' interacts
	with other comma-separated background properties
	to form each [=background image layer=].

<h3 id="background-size" oldids="the-background-size">Sizing Images: the 'background-size' property</h3>

	<pre class="propdef">
	Name: background-size
	Value: <<bg-size>>#
	Initial: auto
	Applies to: all elements
	Inherited: no
	Percentages: see text
	Computed value: list,
		each item a pair of sizes (one per axis)
		each represented as either a keyword or a computed <<length-percentage>> value
	Animation type: repeatable list
	</pre>

	<wpt>
		animations/background-size-composition.html
		animations/background-size-interpolation.html
		background-size-001.html
		background-size-002.html
		background-size-005.html
		background-size-006.html
		background-size-007.html
		background-size-008.html
		background-size-009.html
		background-size-010.html
		background-size-011.html
		background-size-012.html
		background-size-013.html
		background-size-014.html
		background-size-015.html
		background-size-016.html
		background-size-017.html
		background-size-018.html
		background-size-019.html
		background-size-020.html
		background-size-021.html
		background-size-025.html
		background-size-026.html
		background-size-027.html
		background-size-028.html
		background-size-029.html
		background-size-030.html
		background-size-031.html
		background-size-034.html
		background-size-041.html
		background-size-042.html
		background-size-043.html
		background-size-044.html
		background-size-contain-001.html
		background-size-contain-002.html
		background-size-cover-001.html
		background-size-cover-002.html
		background-size-cover-003.html
		background-size-one-value-1x1-image.html
		background-size-percentage-root.html
		background-size-with-negative-value.html
		background-size/background-size-contain-svg-view.html
		background-size/background-size-contain.xht
		background-size/background-size-cover-contain-001.xht
		background-size/background-size-cover-contain-002.xht
		background-size/background-size-cover-svg-view.html
		background-size/background-size-cover-svg.html
		background-size/background-size-cover.xht
		background-size/background-size-near-zero-color.html
		background-size/background-size-near-zero-gradient.html
		background-size/background-size-near-zero-png.html
		background-size/background-size-near-zero-svg.html
		background-size/vector/background-size-vector-001.html
		background-size/vector/background-size-vector-002.html
		background-size/vector/background-size-vector-003.html
		background-size/vector/background-size-vector-004.html
		background-size/vector/background-size-vector-005.html
		background-size/vector/background-size-vector-006.html
		background-size/vector/background-size-vector-007.html
		background-size/vector/background-size-vector-008.html
		background-size/vector/background-size-vector-009.html
		background-size/vector/background-size-vector-010.html
		background-size/vector/background-size-vector-011.html
		background-size/vector/background-size-vector-012.html
		background-size/vector/background-size-vector-013.html
		background-size/vector/background-size-vector-014.html
		background-size/vector/background-size-vector-015.html
		background-size/vector/background-size-vector-016.html
		background-size/vector/background-size-vector-017.html
		background-size/vector/background-size-vector-018.html
		background-size/vector/background-size-vector-019.html
		background-size/vector/background-size-vector-020.html
		background-size/vector/background-size-vector-021.html
		background-size/vector/background-size-vector-022.html
		background-size/vector/background-size-vector-023.html
		background-size/vector/background-size-vector-024.html
		background-size/vector/background-size-vector-025.html
		background-size/vector/background-size-vector-026.html
		background-size/vector/background-size-vector-027.html
		background-size/vector/background-size-vector-028.html
		background-size/vector/background-size-vector-029.html
		background-size/vector/diagonal-percentage-vector-background.html
		background-size/vector/tall--auto--omitted-width-percent-height.html
		background-size/vector/tall--auto--percent-width-nonpercent-height-viewbox.html
		background-size/vector/tall--auto--percent-width-nonpercent-height.html
		background-size/vector/tall--auto--percent-width-omitted-height-viewbox.html
		background-size/vector/tall--auto--percent-width-omitted-height.html
		background-size/vector/tall--auto--percent-width-percent-height-viewbox.html
		background-size/vector/tall--auto--percent-width-percent-height.html
		background-size/vector/tall--auto-32px--nonpercent-width-nonpercent-height-viewbox.html
		background-size/vector/tall--auto-32px--nonpercent-width-nonpercent-height.html
		background-size/vector/tall--auto-32px--nonpercent-width-omitted-height-viewbox.html
		background-size/vector/tall--auto-32px--nonpercent-width-omitted-height.html
		background-size/vector/tall--auto-32px--nonpercent-width-percent-height-viewbox.html
		background-size/vector/tall--auto-32px--nonpercent-width-percent-height.html
		background-size/vector/tall--auto-32px--omitted-width-nonpercent-height-viewbox.html
		background-size/vector/tall--auto-32px--omitted-width-nonpercent-height.html
		background-size/vector/tall--auto-32px--omitted-width-omitted-height-viewbox.html
		background-size/vector/tall--auto-32px--omitted-width-omitted-height.html
		background-size/vector/tall--auto-32px--omitted-width-percent-height-viewbox.html
		background-size/vector/tall--auto-32px--omitted-width-percent-height.html
		background-size/vector/tall--auto-32px--percent-width-nonpercent-height-viewbox.html
		background-size/vector/tall--auto-32px--percent-width-nonpercent-height.html
		background-size/vector/tall--auto-32px--percent-width-omitted-height-viewbox.html
		background-size/vector/tall--auto-32px--percent-width-omitted-height.html
		background-size/vector/tall--auto-32px--percent-width-percent-height-viewbox.html
		background-size/vector/tall--auto-32px--percent-width-percent-height.html
		background-size/vector/tall--contain--height.html
		background-size/vector/tall--contain--nonpercent-width-nonpercent-height-viewbox.html
		background-size/vector/tall--contain--nonpercent-width-nonpercent-height.html
		background-size/vector/tall--contain--nonpercent-width-omitted-height-viewbox.html
		background-size/vector/tall--contain--nonpercent-width-omitted-height.html
		background-size/vector/tall--contain--nonpercent-width-percent-height-viewbox.html
		background-size/vector/tall--contain--nonpercent-width-percent-height.html
		background-size/vector/tall--contain--omitted-width-nonpercent-height-viewbox.html
		background-size/vector/tall--contain--omitted-width-nonpercent-height.html
		background-size/vector/tall--contain--omitted-width-omitted-height-viewbox.html
		background-size/vector/tall--contain--omitted-width-omitted-height.html
		background-size/vector/tall--contain--omitted-width-percent-height-viewbox.html
		background-size/vector/tall--contain--omitted-width-percent-height.html
		background-size/vector/tall--contain--percent-width-nonpercent-height-viewbox.html
		background-size/vector/tall--contain--percent-width-nonpercent-height.html
		background-size/vector/tall--contain--percent-width-omitted-height-viewbox.html
		background-size/vector/tall--contain--percent-width-omitted-height.html
		background-size/vector/tall--contain--percent-width-percent-height-viewbox.html
		background-size/vector/tall--contain--percent-width-percent-height.html
		background-size/vector/tall--contain--width.html
		background-size/vector/tall--cover--height.html
		background-size/vector/tall--cover--nonpercent-width-nonpercent-height--crisp.html
		background-size/vector/tall--cover--nonpercent-width-nonpercent-height-viewbox--crisp.html
		background-size/vector/tall--cover--nonpercent-width-nonpercent-height-viewbox.html
		background-size/vector/tall--cover--nonpercent-width-nonpercent-height.html
		background-size/vector/tall--cover--nonpercent-width-omitted-height-viewbox.html
		background-size/vector/tall--cover--nonpercent-width-omitted-height.html
		background-size/vector/tall--cover--nonpercent-width-percent-height-viewbox.html
		background-size/vector/tall--cover--nonpercent-width-percent-height.html
		background-size/vector/tall--cover--omitted-width-nonpercent-height-viewbox.html
		background-size/vector/tall--cover--omitted-width-nonpercent-height.html
		background-size/vector/tall--cover--omitted-width-omitted-height-viewbox.html
		background-size/vector/tall--cover--omitted-width-omitted-height.html
		background-size/vector/tall--cover--omitted-width-percent-height-viewbox.html
		background-size/vector/tall--cover--omitted-width-percent-height.html
		background-size/vector/tall--cover--percent-width-nonpercent-height-viewbox.html
		background-size/vector/tall--cover--percent-width-nonpercent-height.html
		background-size/vector/tall--cover--percent-width-omitted-height-viewbox.html
		background-size/vector/tall--cover--percent-width-omitted-height.html
		background-size/vector/tall--cover--percent-width-percent-height-viewbox.html
		background-size/vector/tall--cover--percent-width-percent-height.html
		background-size/vector/tall--cover--width.html
		background-size/vector/wide--12px-auto--nonpercent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--12px-auto--nonpercent-width-nonpercent-height.html
		background-size/vector/wide--12px-auto--nonpercent-width-omitted-height-viewbox.html
		background-size/vector/wide--12px-auto--nonpercent-width-omitted-height.html
		background-size/vector/wide--12px-auto--nonpercent-width-percent-height-viewbox.html
		background-size/vector/wide--12px-auto--nonpercent-width-percent-height.html
		background-size/vector/wide--12px-auto--omitted-width-nonpercent-height-viewbox.html
		background-size/vector/wide--12px-auto--omitted-width-nonpercent-height.html
		background-size/vector/wide--12px-auto--omitted-width-omitted-height-viewbox.html
		background-size/vector/wide--12px-auto--omitted-width-omitted-height.html
		background-size/vector/wide--12px-auto--omitted-width-percent-height-viewbox.html
		background-size/vector/wide--12px-auto--omitted-width-percent-height.html
		background-size/vector/wide--12px-auto--percent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--12px-auto--percent-width-nonpercent-height.html
		background-size/vector/wide--12px-auto--percent-width-omitted-height-viewbox.html
		background-size/vector/wide--12px-auto--percent-width-omitted-height.html
		background-size/vector/wide--12px-auto--percent-width-percent-height-viewbox.html
		background-size/vector/wide--12px-auto--percent-width-percent-height.html
		background-size/vector/wide--auto--nonpercent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--auto--nonpercent-width-nonpercent-height.html
		background-size/vector/wide--auto--nonpercent-width-omitted-height-viewbox.html
		background-size/vector/wide--auto--nonpercent-width-omitted-height.html
		background-size/vector/wide--auto--nonpercent-width-percent-height-viewbox.html
		background-size/vector/wide--auto--nonpercent-width-percent-height.html
		background-size/vector/wide--auto--omitted-width-nonpercent-height-viewbox.html
		background-size/vector/wide--auto--omitted-width-nonpercent-height.html
		background-size/vector/wide--auto--omitted-width-omitted-height-viewbox.html
		background-size/vector/wide--auto--omitted-width-omitted-height.html
		background-size/vector/wide--auto--omitted-width-percent-height-viewbox.html
		background-size/vector/wide--auto--omitted-width-percent-height.html
		background-size/vector/wide--auto--percent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--auto--percent-width-nonpercent-height.html
		background-size/vector/wide--auto--percent-width-omitted-height-viewbox.html
		background-size/vector/wide--auto--percent-width-omitted-height.html
		background-size/vector/wide--auto--percent-width-percent-height-viewbox.html
		background-size/vector/wide--auto--percent-width-percent-height.html
		background-size/vector/wide--auto-32px--nonpercent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--auto-32px--nonpercent-width-nonpercent-height.html
		background-size/vector/wide--auto-32px--nonpercent-width-omitted-height-viewbox.html
		background-size/vector/wide--auto-32px--nonpercent-width-omitted-height.html
		background-size/vector/wide--auto-32px--nonpercent-width-percent-height-viewbox.html
		background-size/vector/wide--auto-32px--nonpercent-width-percent-height.html
		background-size/vector/wide--auto-32px--omitted-width-nonpercent-height-viewbox.html
		background-size/vector/wide--auto-32px--omitted-width-nonpercent-height.html
		background-size/vector/wide--auto-32px--omitted-width-omitted-height-viewbox.html
		background-size/vector/wide--auto-32px--omitted-width-omitted-height.html
		background-size/vector/wide--auto-32px--omitted-width-percent-height-viewbox.html
		background-size/vector/wide--auto-32px--omitted-width-percent-height.html
		background-size/vector/wide--auto-32px--percent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--auto-32px--percent-width-nonpercent-height.html
		background-size/vector/wide--auto-32px--percent-width-omitted-height-viewbox.html
		background-size/vector/wide--auto-32px--percent-width-omitted-height.html
		background-size/vector/wide--auto-32px--percent-width-percent-height-viewbox.html
		background-size/vector/wide--auto-32px--percent-width-percent-height.html
		background-size/vector/wide--contain--height.html
		background-size/vector/wide--contain--nonpercent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--contain--nonpercent-width-nonpercent-height.html
		background-size/vector/wide--contain--nonpercent-width-omitted-height-viewbox.html
		background-size/vector/wide--contain--nonpercent-width-omitted-height.html
		background-size/vector/wide--contain--nonpercent-width-percent-height-viewbox.html
		background-size/vector/wide--contain--nonpercent-width-percent-height.html
		background-size/vector/wide--contain--omitted-width-nonpercent-height-viewbox.html
		background-size/vector/wide--contain--omitted-width-nonpercent-height.html
		background-size/vector/wide--contain--omitted-width-omitted-height-viewbox.html
		background-size/vector/wide--contain--omitted-width-omitted-height.html
		background-size/vector/wide--contain--omitted-width-percent-height-viewbox.html
		background-size/vector/wide--contain--omitted-width-percent-height.html
		background-size/vector/wide--contain--percent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--contain--percent-width-nonpercent-height.html
		background-size/vector/wide--contain--percent-width-omitted-height-viewbox.html
		background-size/vector/wide--contain--percent-width-omitted-height.html
		background-size/vector/wide--contain--percent-width-percent-height-viewbox.html
		background-size/vector/wide--contain--percent-width-percent-height.html
		background-size/vector/wide--contain--width.html
		background-size/vector/wide--cover--height.html
		background-size/vector/wide--cover--nonpercent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--cover--nonpercent-width-nonpercent-height.html
		background-size/vector/wide--cover--nonpercent-width-omitted-height-viewbox.html
		background-size/vector/wide--cover--nonpercent-width-omitted-height.html
		background-size/vector/wide--cover--nonpercent-width-percent-height-viewbox.html
		background-size/vector/wide--cover--nonpercent-width-percent-height.html
		background-size/vector/wide--cover--omitted-width-nonpercent-height-viewbox.html
		background-size/vector/wide--cover--omitted-width-nonpercent-height.html
		background-size/vector/wide--cover--omitted-width-omitted-height-viewbox.html
		background-size/vector/wide--cover--omitted-width-omitted-height.html
		background-size/vector/wide--cover--omitted-width-percent-height-viewbox.html
		background-size/vector/wide--cover--omitted-width-percent-height.html
		background-size/vector/wide--cover--percent-width-nonpercent-height-viewbox.html
		background-size/vector/wide--cover--percent-width-nonpercent-height.html
		background-size/vector/wide--cover--percent-width-omitted-height-viewbox.html
		background-size/vector/wide--cover--percent-width-omitted-height.html
		background-size/vector/wide--cover--percent-width-percent-height-viewbox.html
		background-size/vector/wide--cover--percent-width-percent-height.html
		background-size/vector/wide--cover--width.html
		background-size/vector/zero-height-ratio-5px-auto.html
		background-size/vector/zero-height-ratio-auto-5px.html
		background-size/vector/zero-height-ratio-auto-auto.html
		background-size/vector/zero-height-ratio-contain.html
		background-size/vector/zero-height-ratio-cover.html
		background-size/vector/zero-ratio-no-dimensions-5px-auto.html
		background-size/vector/zero-ratio-no-dimensions-auto-5px.html
		background-size/vector/zero-ratio-no-dimensions-auto-auto.html
		background-size/vector/zero-ratio-no-dimensions-contain.html
		background-size/vector/zero-ratio-no-dimensions-cover.html
		background-size/vector/zero-width-ratio-5px-auto.html
		background-size/vector/zero-width-ratio-auto-5px.html
		background-size/vector/zero-width-ratio-auto-auto.html
		background-size/vector/zero-width-ratio-contain.html
		background-size/vector/zero-width-ratio-cover.html
		css3-background-size-001.html
		css3-background-size-contain.html
		css3-background-size.html
		inheritance.sub.html
		subpixel-repeat-no-repeat-mix.html
		parsing/background-size-computed.html
		parsing/background-size-invalid.html
		parsing/background-size-valid.html
	</wpt>

	This property specifies the size of each [=background image=].
	The property's value is given as a comma-separated list
	of <<bg-size>> values where

	<pre class=prod><dfn><<bg-size>></dfn> = [ <<length-percentage [0,∞]>> | auto ]{1,2} | cover | contain</pre>

	Values have the following meanings:

	<dl dfn-for=background-size dfn-type=value>
		<dt><dfn>contain</dfn></dt>
		<dd>
			Scale the image, while preserving its [=natural aspect ratio=] (if any),
			to the largest size such that both its width and its height
			can fit inside the [=background positioning area=].

		<dt><dfn>cover</dfn></dt>
		<dd>
			Scale the image, while preserving its [=natural aspect ratio=] (if any),
			to the smallest size such that both its width and its height
			can completely cover the [=background positioning area=].

		<dt>[ <dfn><<length-percentage [0,∞]>></dfn>
			| <dfn>auto</dfn> ]{1,2}</dt>
		<dd>
			The first value gives the width of the corresponding image,
			the second value its height.
			If only one value is given
			the second is assumed to be ''background-size/auto''.

			A <<percentage>> is relative to the [=background positioning area=].

			An ''background-size/auto'' value for one dimension
			is resolved by using the image's [=natural aspect ratio=]
			and the size of the other dimension,
			or failing that, using the image's [=natural size=],
			or failing that, treating it as ''100%''.

			If both values are ''background-size/auto''
			then the [=natural width=] and/or [=natural height|height=] of the image
			should be used, if any,
			the missing dimension (if any) behaving as ''background-size/auto''
			as described above.
			If the image has neither [=natural size=],
			its size is determined as for ''contain''.

			Negative values are invalid.
	</dl>

	<div class="example">
		Here are some examples.
		The first example stretches the background image
		independently in both dimensions
		to completely cover the content area:

		<pre>
		div {
		  background-image: url(plasma.png);
		  background-repeat: no-repeat;
		  background-size: 100% 100%;
		  background-origin: content-box }
		</pre>

		The second example stretches the image
		so that exactly two copies fit horizontally.
		The aspect ratio is preserved:

		<pre>
		p {
		  background-image: url(tubes.png);
		  background-size: 50% auto;
		  background-origin: border-box }
		</pre>

		This example forces the background image to be 15 by 15 pixels:

		<pre>
		p {
		  background-size: 15px 15px;
		  background-image: url(tile.png)}
		</pre>

		This example uses the image's natural size.
		Note that this is the only possible behavior in CSS level&nbsp;1 and 2.

		<pre>
			body {
		  background-size: auto;            /* default */
		  background-image: url(flower.png) }
		</pre>

		The following example rounds the height of the image to 33.3%,
		up from the specified value of 30%.
		At 30%, three images would fit entirely and a fourth only partially.
		After rounding, three images fit exactly.
		The width of the image is 20% of the background positioning area width
		and is not rounded.

		<pre>
		p {
		  background-image: url(chain.png);
		  background-repeat: no-repeat round;
		  background-size: 20% 30% }
		</pre>
	</div>

	If 'background-repeat' is ''background-repeat/round''
	for one (or both) dimensions,
	there is a second step.
	The UA must scale the image in that dimension (or both dimensions)
	so that it fits a whole number of times in the [=background positioning area=].
	In the case of the width (height is analogous):

	<blockquote>
		If <var>X</var> &ne; 0 is the width of the image after step one
		and <var>W</var> is the width of the background positioning area,
		then the rounded width
		<var>X'</var> = <var>W</var> / round(<var>W</var> / <var>X</var>)
		where round() is a function that returns the nearest natural number
		(integer greater than zero).
	</blockquote>

	If 'background-repeat' is ''background-repeat/round'' for one dimension only
	and if 'background-size' is ''background-size/auto'' for the other dimension,
	then there is a third step:
	that other dimension is scaled so that the original aspect ratio is restored.

	<div class=example>
		In this example the background image is shown at its natural size:

		<pre>
		div {
		  background-image: url(image1.png);
		  background-repeat: repeat;         /* default */
		  background-size: auto }            /* default */
		</pre>

		In the following example, the background is shown with a width of
		3em and its height is scaled proportionally to keep the original
		aspect ratio:

		<pre>
		div {
		  background-image: url(image2.png);
		  background-repeat: repeat;         /* default */
		  background-size: 3em }             /* = '3em auto' */
		</pre>

		In the following example,
		the background is shown with a width of approximately 3em:
		scaled so that it fits a whole number of times in the width of the background.
		The height is scaled proportionally to keep the original aspect ratio:

		<pre>
		div {
		  background-image: url(image3.png);
		  background-repeat: round repeat;
		  background-size: 3em auto }
		</pre>

		In the following example, the background image is shown
		with a width of 3em and a height that is either
		the height corresponding to that width at the original aspect ratio
		or slightly less:

		<pre>
		div {
		  background-image: url(image4.png);
		  background-repeat: repeat round;
		  background-size: 3em auto }
		</pre>

		In the following example,
		the background image is shown with a height of approximately 4em:
		scaled slightly so that it fits a whole number of times in the background height.
		The width is the approximately the width that corresponds to
		a 4em height at the original aspect ratio:
		scaled slightly so that it fits a whole number of times
		in the background width.

		<pre>
		div {
		  background-image: url(image5.png);
		  background-repeat: round;
		  background-size: auto 4em }
		</pre>
	</div>

	If the background image's width or height resolves to zero,
	this causes the image not to be displayed.
	(The effect is the same as if it had been a transparent image.)

	See [[#layering]] for how 'background-size' interacts
	with other comma-separated background properties
	to form each [=background image layer=].

<h4 id="bg-size-serialization">
Serialization of 'background-size' values</h4>

	The [=specified value=] and [=computed value=] of the <<bg-size>> type
	always serialize as two values, even when the second value is ''background-size/auto'',
	due to the [[cssom#serializing-css-values|shortest, most backwards-compatible serialization principle]].

<h3 id="background" oldids="the-background">
Backgrounds Shorthand: the 'background' property</h3>

	<pre class="propdef">
	Name: background
	Value: <<bg-layer>>#? , <<final-bg-layer>>
	Initial: see individual properties
	Applies to: all elements
	Inherited: no
	Percentages: see individual properties
	Computed value: see individual properties
	Animation type: see individual properties
	</pre>

	<wpt>
		background-331.html
		background-332.html
		background-333.html
		background-334.html
		background-335.html
		background-336.html
		parsing/background-computed.html
		parsing/background-invalid.html
		parsing/background-shorthand-serialization.html
		parsing/background-valid.html
	</wpt>

	The 'background' property is a [=shorthand property=]
	for setting most background properties at the same place in the style sheet.
	The number of comma-separated items defines the number of [=background image layers=].
	Given a valid declaration, for each layer
	the shorthand first sets the corresponding value of each of
	'background-image',
	'background-position',
	'background-size',
	'background-repeat',
	'background-origin',
	'background-clip'
	and 'background-attachment' to
	that property's [=initial value=],
	then assigns any explicit values
	specified for this layer in the declaration.
	Finally 'background-color' is set to the specified color, if any,
	else set to its initial value.

	This property's value is given as a comma-separated list
	of values where

	<pre class=prod>
	<dfn>&lt;bg-layer></dfn> = <<bg-image>> || <<bg-position>> [ / <<bg-size>> ]? || <<repeat-style>> || <<attachment>> || <<visual-box>> || <<visual-box>>
	<dfn>&lt;final-bg-layer></dfn> =  <<bg-image>> || <<bg-position>> [ / <<bg-size>> ]? || <<repeat-style>> || <<attachment>> || <<visual-box>> || <<visual-box>> || <<'background-color'>></pre>

	Note: A color is permitted in <<final-bg-layer>>, but not in <<bg-layer>>.

	If one <<visual-box>> value is present
	then it sets both 'background-origin' and 'background-clip' to that value.
	If two values are present,
	then the first sets 'background-origin' and the second 'background-clip'.

	<div class="example">
		In the first rule of the following example, only a value for
		'background-color' has been given and the
		other individual properties are set to their initial values. In the
		second rule, many individual properties have been specified.

		<pre>
		body { background: red }
		p { background: url("chess.png") 40% / 10em gray
		                round fixed border-box; }
		</pre>

		The first rule is equivalent to:

		<pre>
		body {
		    background-color: red;
		    background-position: 0% 0%;
		    background-size: auto;
		    background-repeat: repeat;
		    background-clip: border-box;
		    background-origin: padding-box;
		    background-attachment: scroll;
		    background-image: none }
		</pre>

		The second is equivalent to:

		<pre>
		p {
		    background-color: gray;
		    background-position: 40% 50%;
		    background-size: 10em auto;
		    background-repeat: round;
		    background-clip: border-box;
		    background-origin: border-box;
		    background-attachment: fixed;
		    background-image: url(chess.png) }
		</pre>
	</div>

	<div class=example>
		The following example shows how a both
		a background color (''#CCC'') and a background image (''url(metal.jpg)'')
		are set.
		The image is rescaled to the full width of the element:

		<pre>
			E { background: #CCC url("metal.jpg") top left / 100% auto no-repeat}
		</pre>
	</div>

	<div class=example>
		Another example shows equivalence:

		<pre>
		div { background: padding-box url(paper.jpg) white center }
		div {
		    background-color: white;
		    background-image: url(paper.jpg);
		    background-repeat: repeat;
		    background-attachment: scroll;
		    background-position: center;
		    background-clip: padding-box;
		    background-origin: padding-box;
		    background-size: auto auto }
		</pre>
	</div>

	<div class=example>
		The following declaration with multiple, comma-separated values

		<pre>
		background: url(a.png) top left no-repeat,
		            url(b.png) center / 100% 100% no-repeat,
		            url(c.png) white;
		</pre>

		is equivalent to

		<pre>
		background-image:      url(a.png),  url(b.png),          url(c.png);
		background-position:   top left,    center,              top left;
		background-repeat:     no-repeat,   no-repeat,           repeat;
		background-clip:       border-box,  border-box,          border-box;
		background-origin:     padding-box, padding-box,         padding-box;
		background-size:       auto auto,   100% 100%,           auto auto;
		background-attachment: scroll,      scroll,              scroll;
		background-color:      white;
		</pre>
	</div>


<h3 id="special-backgrounds">
Backgrounds of Special Elements</h3>

	The document <a href="https://www.w3.org/TR/CSS2/intro.html#the-canvas">canvas</a>
	is the infinite surface over which the document is rendered. [[!CSS2]]
	Since no element corresponds to the canvas,
	in order to allow styling of the canvas
	CSS propagates the background of the [=root element=]
	(or, in the case of HTML, the &lt;body&gt; element)
	as described below.
	However, if the element whose background would be used for the canvas
	is ''display: none'',
	then the [=canvas background=] is transparent.

	If the [=canvas background=] is not opaque,
	the <dfn export>canvas surface</dfn> below it shows through.
	The texture of the [=canvas surface=] is UA-dependent
	(but is typically an opaque white).

<h4 id="root-background">
The Canvas Background and the Root Element</h4>

	The background of the [=root element=] becomes the <dfn export>canvas background</dfn>
	and its [=background painting area=] extends
	to cover the entire <a href="https://www.w3.org/TR/CSS2/intro.html#the-canvas">canvas</a>.
	However, any images are sized and positioned relative to the root element’s box
	as if they were painted for that element alone.
	(In other words, the
	<a href="#background-positioning-area">background <em>positioning</em> area</a>
	is determined as for the root element.)
	The root element does not paint this background again,
	i.e., the [=used value=] of its background is ''transparent''.

	<wpt>
		background-margin-iframe-root.html
		background-margin-root.html
		background-margin-transformed-root.html
		background-margin-will-change-root.html
	</wpt>

<h4 id="body-background">
The Canvas Background and the HTML &lt;body&gt; Element</h4>

	For documents whose root element is
	an HTML <code class="html">HTML</code> element
	or an XHTML <code class="html">html</code> element [[!HTML]]:
	if the [=computed value=] of 'background-image' on the [=root element=]
	is ''background-image/none'' and its 'background-color' is ''transparent'',
	user agents must instead propagate
	the [=computed values=] of the background properties
	from that element's first
	HTML <code class="html">BODY</code> or XHTML <code class="html">body</code>
	child element.
	The [=used values=]
	of that <code class="html">BODY</code> element's background properties
	are their [=initial values=],
	and the propagated values are treated
	as if they were specified on the root element.
	It is recommended that authors of HTML documents specify the canvas background
	using the <code class=html>BODY</code> element
	rather than the <code class=html>HTML</code> element.

	<wpt>
		document-canvas-remove-body.html
	</wpt>

	Note: Using [=containment=] disables
	this special handling of the HTML <{body}> element.
	See the [[CSS-CONTAIN-1#contain-property]] for details.

	<div class="example">
		According to these rules, the canvas underlying the following HTML document
		will have a “marble” background:

		<pre>
		&lt;!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.0//EN'
		  &gt;
		&lt;html&gt;
		  &lt;head&gt;
		    &lt;title&gt;Setting the canvas background&lt;/title&gt;
		    &lt;style type="text/css"&gt;
		       body { background: url("http://example.org/marble.png") }
		    &lt;/style&gt;
		  &lt;/head&gt;
		  &lt;body&gt;
		    &lt;p&gt;My background is marble.&lt;/p&gt;
		  &lt;/body&gt;
		&lt;/html&gt;
		</pre>
	</div>

<h4 id="first-line-background">
The ''::first-line'' Pseudo-element‘s Background</h4>

	The ''::first-line'' pseudo-element
	is like an inline-level element
	for the purposes of the background
	(see section 5.12.1 of [[!CSS2]]).
	That means, e.g., that in a left-justified first line,
	the background does not necessarily extend
	all the way to the right edge.

	<wpt>
		linear-gradient-currentcolor-first-line.html
	</wpt>

<h2 id="borders">
Borders</h2>

	The [=border=] can either be a predefined style
	(solid line, double line, dotted line, pseudo-3D border, etc.)
	or it can be an image.
	In the former case, various properties define
	the style ('border-style'),
	color ('border-color'),
	and thickness ('border-width')
	of the border.

<h3 id="border-color" oldids="the-border-color">
Line Colors: the 'border-color' properties</h3>

	<pre class="propdef">
	Name: border-top-color, border-right-color, border-bottom-color, border-left-color
	Value: <<color>>
	Initial: <a href="https://www.w3.org/TR/css-color-4/#currentcolor-color">currentColor</a>
	Applies to: all elements except [=ruby base containers=] and [=ruby annotation containers=]
	Inherited: no
	Logical property group: border-color
	Percentages: N/A
	Computed value: computed color
	Animation type: by computed value
	</pre>

	<pre class="propdef">
	Name: border-color
	Value: <<color>>{1,4}
	Initial: see individual properties
	Applies to: all elements except [=ruby base containers=] and [=ruby annotation containers=]
	Inherited: no
	Percentages: N/A
	Computed value: see individual properties
	Animation Type: see individual properties
	</pre>

	<wpt>
		animations/border-color-interpolation.html
		border-image-displayed-with-transparent-border-color.html
		color-mix-currentcolor-border-repaint-parent.html
		color-mix-currentcolor-border-repaint.html
		currentcolor-border-repaint-parent.html
		inheritance.sub.html
		parsing/border-color-computed.html
		parsing/border-color-invalid.html
		parsing/border-color-shorthand.html
		parsing/border-color-valid.html
	</wpt>

	These properties set the foreground <dfn noexport lt="border color" id="border-color-dfn">color</dfn>
	of the [=border=] specified by the 'border-style' properties.

	The 'border-color' property is a [=shorthand property=] for setting
	'border-top-color', 'border-right-color', 'border-bottom-color', and 'border-left-color'
	in a single declaration.

	If there is only one component value,
	it applies to all sides.
	If there are two values,
	the top and bottom are set to the first value
	and the right and left are set to the second.
	If there are three values,
	the top is set to the first value,
	the left and right are set to the second,
	and the bottom is set to the third.
	If there are four values
	they apply to the top, right, bottom, and left, respectively.


<h3 id="border-style" oldids="the-border-style">Line Patterns: the 'border-style' properties</h3>

	<pre class="propdef">
	Name: border-top-style, border-right-style, border-bottom-style, border-left-style
	Value: <<line-style>>
	Initial: none
	Applies to: all elements except [=ruby base containers=] and [=ruby annotation containers=]
	Inherited: no
	Logical property group: border-style
	Percentages: N/A
	Computed value: specified keyword
	Animation type: discrete
	</pre>

	<pre class="propdef">
	Name: border-style
	Value: <<line-style>>{1,4}
	Initial: see individual properties
	Applies to: all elements except [=ruby base containers=] and [=ruby annotation containers=]
	Inherited: no
	Percentages: N/A
	Computed value: see individual properties
	Animation type: see individual properties
	</pre>

	<wpt>
		inheritance.sub.html
		parsing/border-style-computed.html
		parsing/border-style-invalid.html
		parsing/border-style-shorthand.html
		parsing/border-style-valid.html
	</wpt>


	These properties control whether a [=border=] appears,
	and if it does what <dfn noexport lt="border style" id="border-style-dfn">style</dfn> it's drawn in
	(if it is not overridden by a <a href="#border-images">border image</a>).

	The 'border-style' property is a [=shorthand property=] for setting
	'border-top-style', 'border-right-style', 'border-bottom-style', and 'border-left-style'
	in a single declaration.

	If there is only one component value,
	it applies to all sides.
	If there are two values,
	the top and bottom are set to the first value
	and the right and left are set to the second.
	If there are three values,
	the top is set to the first value,
	the left and right are set to the second,
	and the bottom is set to the third.
	If there are four values
	they apply to the top, right, bottom, and left, respectively.

	The style is specified as a <<line-style>> keyword, where
	<pre class=prod><dfn><<line-style>></dfn> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset</pre>

	Values have the following meanings:

	<dl dfn-type=value dfn-for="<line-style>, border-style, border-top-style, border-left-style, border-bottom-style, border-right-style, border">
		<dt><dfn>none</dfn>
		<dd>
			No border.
			Color and width are ignored (i.e., the border has width 0).
			Note this means that the initial value of 'border-image-width'
			will also resolve to zero.

		<dt><dfn>hidden</dfn>
		<dd>
			Same as ''border-style/none'',
			but has different behavior in the border conflict resolution rules
			for border-collapsed tables [[!CSS2]].

		<dt><dfn>dotted</dfn>
		<dd>
			A series of round dots.

		<dt><dfn>dashed</dfn>
		<dd>
			A series of square-ended dashes.

		<dt><dfn>solid</dfn>
		<dd>
			A single line segment.

		<dt><dfn>double</dfn>
		<dd>
			Two parallel solid lines with some space between them.
			(The thickness of the lines is not specified,
				but the sum of the lines and the space must equal 'border-width'.)

		<dt><dfn>groove</dfn>
		<dd>
			Looks as if it were carved in the canvas.
			(This is typically achieved by creating a “shadow” from two colors
				that are slightly lighter and darker than the specified 'border-color'.)

		<dt><dfn>ridge</dfn>
		<dd>
			Looks as if it were coming out of the canvas.

		<dt><dfn>inset</dfn>
		<dd>
			Looks as if the content on the inside of the border
			is sunken into the canvas.
			Treated as ''ridge'' in the
			<a href="https://www.w3.org/TR/CSS2/tables.html#collapsing-borders">collapsing border model</a>. [[!CSS2]]

		<dt><dfn>outset</dfn>
		<dd>
			Looks as if the content on the inside of the border
			is raised out of the canvas.
			Treated as ''groove'' in the
			<a href="https://www.w3.org/TR/CSS2/tables.html#collapsing-borders">collapsing border model</a>. [[!CSS2]]
	</dl>

	Borders are drawn in front of the element's background,
	but behind the element's content (in case it overlaps).

	<figure>
		<img src="images/borderstyles.png" width="669" height="383"
		     alt=""
		>

		<figcaption>Example renderings of the predefined border styles.</figcaption>
	</figure>

	Note: Border colors close to black or white
	may need different color calculations than colors in between
	in order to create the required “3D” effect
	of ''groove'', ''ridge'', ''border-style/inset'', or ''border-style/outset''.

	Note: There is no control over
	the spacing of the dots and dashes,
	nor over the length of the dashes.
	Implementations are encouraged to choose a spacing
	that makes the corners symmetrical.

	Note: This specification does not define how borders of different styles
	should be joined in the corner.
	Also note that rounded corners may cause the corners and the contents to overlap,
	if the padding is less than the radius of the corner.

<h3 id="border-width" oldids="the-border-width">
Line Thickness: the 'border-width' properties</h3>

	<pre class="propdef">
	Name: border-top-width, border-right-width, border-bottom-width, border-left-width
	Value: <<line-width>>
	Initial: medium
	Applies to: all elements except [=ruby base containers=] and [=ruby annotation containers=]
	Inherited: no
	Logical property group: border-width
	Percentages: N/A
	Computed value: absolute length, [=snapped as a border width=]
	Animation Type: by computed value
	</pre>

	<pre class="propdef">
	Name: border-width
	Value: <<line-width>>{1,4}
	Initial: see individual properties
	Applies to: all elements except [=ruby base containers=] and [=ruby annotation containers=]
	Inherited: no
	Percentages: see individual properties
	Computed value: see individual properties
	Animation Type: see individual properties
	</pre>

	<wpt>
		animations/border-bottom-width-composition.html
		animations/border-image-width-composition.html
		animations/border-image-width-interpolation.html
		animations/border-left-width-composition.html
		animations/border-right-width-composition.html
		animations/border-top-width-composition.html
		animations/border-width-interpolation.html
		border-bottom-width-medium.html
		border-bottom-width-thick.html
		border-bottom-width-thin.html
		border-left-width-medium.html
		border-left-width-thick.html
		border-left-width-thin.html
		border-right-width-medium.html
		border-right-width-thick.html
		border-right-width-thin.html
		border-top-width-medium.html
		border-top-width-thick.html
		border-top-width-thin.html
		border-width-cssom.html
		border-width-pixel-snapping-001-a.html
		border-width-pixel-snapping-001-b.html
		border-width-small-values-001-a.html
		border-width-small-values-001-b.html
		border-width-small-values-001-c.html
		border-width-small-values-001-d.html
		border-width-small-values-001-e.html
		inheritance.sub.html
		parsing/border-width-computed.html
		parsing/border-width-invalid.html
		parsing/border-width-shorthand.html
		parsing/border-width-valid.html
	</wpt>

	These properties specify the thickness of the [=border=],
	i.e. the <dfn export id="border-width-dfn">border width</dfn>.
	Where

	<pre class=prod><dfn><<line-width>></dfn> = <<length [0,∞]>> | thin | medium | thick</pre>

	<p dfn-type=value dfn-for="<line-width>, border-width, border-top-width, border-left-width, border-bottom-width, border-right-width, border">
	Negative values are invalid.
	The <dfn>thin</dfn>, <dfn>medium</dfn>, and <dfn>thick</dfn> keywords
	are equivalent to ''1px'', ''3px'', and ''5px'', respectively.

	The 'border-width' property is a [=shorthand property=] for setting
	'border-top-width', 'border-right-width', 'border-bottom-width', and 'border-left-width'
	in a single declaration.

	If there is only one component value,
	it applies to all sides.
	If there are two values,
	the top and bottom are set to the first value
	and the right and left are set to the second.
	If there are three values,
	the top is set to the first value,
	the left and right are set to the second,
	and the bottom is set to the third.
	If there are four values
	they apply to the top, right, bottom, and left, respectively.

	The [=resolved value=] for the 'border-width' properties is the [=used value=].

	If the 'border-style' corresponding to a given 'border-width' is ''border-style/none'' or ''hidden'',
	then the [=used value|used=] width is 0.

	Note: Although the [=initial value|initial=] width is ''medium'',
	the [=initial value|initial=] style is ''border-style/none'';
	therefore the [=used value|used=] initial width is 0.

<h3 id="border-shorthands" oldids="the-border-shorthands">
Border Shorthand Properties</h3>

	<pre class=propdef>
	Name: border-top, border-right, border-bottom, border-left
	Value: <<line-width>> || <<line-style>> || <<color>>
	Initial: See individual properties
	Applies to: all elements except [=ruby base containers=] and [=ruby annotation containers=]
	Inherited: no
	Percentages: N/A
	Computed value: see individual properties
	Animation Type: see individual properties
	</pre>

	These [=shorthand properties=] set
	the 'border-width', 'border-color', and 'border-style'
	of the top, right, bottom, and left [=borders=] of a box.
	Omitted values are set to their [=initial values=].

	<pre class=propdef>
	Name: border
	Value: <<line-width>> || <<line-style>> || <<color>>
	Initial: See individual properties
	Applies to: all elements except [=ruby base containers=] and [=ruby annotation containers=]
	Inherited: no
	Percentages: N/A
	Computed value: see individual properties
	Animation Type: see individual properties
	</pre>

	<wpt>
		parsing/border-invalid.html
		parsing/border-shorthand.html
		parsing/border-valid.html
	</wpt>

	The 'border' property is a [=shorthand property=] for setting
	the same 'border-width', 'border-color', and 'border-style'
	for all four borders of a box.
	Unlike the shorthand 'margin' and 'padding' properties,
	the 'border' property cannot set different values on the four borders.
	To do so, one or more of the other border properties must be used.

	The 'border' shorthand also resets 'border-image' to its initial value.
	It is therefore recommended that authors use the 'border' shorthand,
	rather than other shorthands or the individual properties,
	to override any border settings earlier in the cascade.
	This will ensure that 'border-image' has also been reset
	to allow the new styles to take effect.

	Note: The CSS Working Group intends for the 'border' shorthand
	to reset all border properties in future levels of CSS as well.
	For example, if a <css>border-characters</css> property
	is introduced in the future to allow glyphs as borders,
	it will also be reset by the 'border' shorthand.
	By using the 'border' shorthand to reset borders,
	authors can be guaranteed a “blank canvas”
	no matter what properties are introduced in the future.

	<div class="example">
		For example, the first rule below is equivalent to the set of five
		rules shown after it:

		<pre>
		p { border: solid red }
		p {
		  border-top: solid red;
		  border-right: solid red;
		  border-bottom: solid red;
		  border-left: solid red;
		  border-image: none;
		}
		</pre>
	</div>

	Since, to some extent, the properties have overlapping functionality,
	the order in which the rules are specified is important.

	<div class="example">
		Consider this example:
		<pre>
		blockquote {
		  border-color: red;
		  border-left: double;
		  color: black
		}
		</pre>

		In the above example,
		the color of the left border is black, while the other borders are red.
		This is due to 'border-left' setting the width, style, and color.
		Since the color value is not given by the 'border-left' property,
		it will be taken from the 'color' property.
		The fact that the 'color' property is set after the 'border-left' property
		is not relevant.
	</div>


<h2 id="corners">
Rounded Corners</h2>

<h3 id="border-radius" oldids="the-border-radius">
Curve Radii: the 'border-radius' properties</h3>

	<pre class=propdef>
	Name: border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius
	Value: <<length-percentage [0,∞]>>{1,2}
	Initial: 0
	Applies to: all elements (but see prose)
	Inherited: no
	Logical property group: border-radius
	Percentages: Refer to corresponding dimension of the <a>border box</a>.
	Computed value: pair of computed <<length-percentage>> values
	Animation Type: by computed value
	</pre>

	<pre class=propdef>
	Name: border-radius
	Value: <<length-percentage [0,∞]>>{1,4} [ / <<length-percentage [0,∞]>>{1,4} ]?
	Initial: see individual properties
	Applies to: all elements (but see prose)
	Inherited: no
	Percentages: Refer to corresponding dimension of the <a>border box</a>.
	Computed value: see individual properties
	Animation Type: see individual properties
	</pre>

	<wpt>
		animations/border-bottom-left-radius-composition.html
		animations/border-bottom-right-radius-composition.html
		animations/border-radius-interpolation.html
		animations/border-top-left-radius-composition.html
		animations/border-top-right-radius-composition.html
		border-bottom-left-radius-001.xht
		border-bottom-left-radius-004.xht
		border-bottom-left-radius-005.xht
		border-bottom-left-radius-010.xht
		border-bottom-left-radius-011.xht
		border-bottom-left-radius-014.xht
		border-bottom-right-radius-001.xht
		border-bottom-right-radius-004.xht
		border-bottom-right-radius-005.xht
		border-bottom-right-radius-010.xht
		border-bottom-right-radius-011.xht
		border-bottom-right-radius-014.xht
		border-radius-001.xht
		border-radius-002.xht
		border-radius-003.xht
		border-radius-004.xht
		border-radius-005.xht
		border-radius-006.xht
		border-radius-007.xht
		border-radius-008.xht
		border-radius-009.xht
		border-radius-010.xht
		border-radius-011.xht
		border-radius-012.html
		border-radius-013.html
		border-radius-clip-001.html
		border-radius-clip-002.htm
		border-radius-clipping-002.html
		border-radius-clipping-with-transform-001.html
		border-radius-css-text.html
		border-radius-dynamic-from-no-radius.html
		border-radius-horizontal-value-is-zero.html
		border-radius-shorthand-002.html
		border-top-left-radius-001.xht
		border-top-left-radius-004.xht
		border-top-left-radius-005.xht
		border-top-left-radius-010.xht
		border-top-left-radius-011.xht
		border-top-left-radius-014.xht
		border-top-right-radius-001.xht
		border-top-right-radius-004.xht
		border-top-right-radius-005.xht
		border-top-right-radius-010.xht
		border-top-right-radius-011.xht
		border-top-right-radius-014.xht
		box-shadow-border-radius-001.html
		css-border-radius-001.html
		inheritance.sub.html
		inner-border-non-renderable.html
		parsing/border-radius-computed.html
		parsing/border-radius-invalid.html
		parsing/border-radius-valid.html
		parsing/webkit-border-radius-valid.html
	</wpt>

	The two <<length-percentage>> values of the 'border-*-radius' properties
	define the <dfn id="border-radii" lt="border radius">radii</dfn> of
	a quarter ellipse that defines the shape of the corner
	of the outer [=border edge=] (see the diagram below).
	The first value is the horizontal radius,
	the second the vertical radius.
	If the second value is omitted it is copied from the first.
	If either length is zero, the corner is square, not rounded.
	Percentages for the horizontal radius refer to the width of the [=border box=],
	whereas percentages for the vertical radius refer to the height of the [=border box=].
	Negative values are invalid.

	<figure>
		<img src="images/corner.png" width="289" height="179"
		     alt="Diagram of the inscribed ellipse"
		>

		<figcaption>
			The two values of ''border-top-left-radius: 55pt 25pt''
			define the curvature of the corner.
		</figcaption>
	</figure>

	<div class=example>
		This example draws ovals of 15em wide and 10em high:

		<pre>
		DIV.standout {
		    width: 13em;
		    height: 8em;
		    border: solid black 1em;
		    border-radius: 7.5em 5em }
		</pre>
	</div>

	The 'border-radius' shorthand sets all four 'border-*-radius' properties.
	If values are given before and after the slash,
	then the values before the slash set the horizontal radii
	and the values after the slash set the vertical radii.
	If there is no slash, then the values set the radii in both axes equally.
	The four values for each radii are given in the order
	top-left, top-right, bottom-right, bottom-left.
	If bottom-left is omitted it is the same as top-right.
	If bottom-right is omitted it is the same as top-left.
	If top-right is omitted it is the same as top-left.

	<div class="example">
		<pre>
		border-radius: 4em;
		</pre>
		is equivalent to
		<pre>
		border-top-left-radius:     4em;
		border-top-right-radius:    4em;
		border-bottom-right-radius: 4em;
		border-bottom-left-radius:  4em;
		</pre>
		and
		<pre>
		border-radius: 2em 1em 4em / 0.5em 3em;
		</pre>
		is equivalent to
		<pre>
		border-top-left-radius:     2em 0.5em;
		border-top-right-radius:    1em 3em;
		border-bottom-right-radius: 4em 0.5em;
		border-bottom-left-radius:  1em 3em;
		</pre>
	</div>

<h3 id="corner-shaping">
Corner Shaping</h3>

	The [=padding edge=] (inner border) radius is
	the outer border radius minus the corresponding border thickness.
	In the case where this results in a negative value,
	the inner radius is zero.
	(In such cases the center of the border’s inner curve might not coincide
	with that of its outer curve.)
	Likewise the [=content edge=] radius is
	the [=padding edge=] radius minus the corresponding [=padding=],
	or if that is negative, zero.
	The border and padding thicknesses in the curved region
	are thus interpolated from the adjoining sides,
	and when two adjoining borders are of different thicknesses
	the corner will show a smooth transition
	between the thicker and thinner borders.

	All border styles (''solid'', ''dotted'',  ''border-style/inset'', etc.)
	follow the curve of the border.

	<figure>
		<img src="images/smooth-radius.png" width="407" height="176"
		     alt=""
		>

		<figcaption>
			The effect of a rounded corner when the two borders it connects
			are of unequal thickness (left)
			and the effect of a rounded corner on borders
			that are thicker than the radius of the corner (right).
		</figcaption>
	</figure>


	Note: If the center of a corner's outer curve
	is past an opposite [=padding edge=]
	(in the [=border area=] of a side opposite the corner),
	the inner curve will not be a full quarter ellipse.

	<figure>
		<table>
			<tr>
				<td>
					<pre>
					p { width: 70px; height: 70px; border: solid 30px;
					border-color: orange orange silver silver;
					border-top-right-radius: 100%; }
					</pre>
				<td>
					<img src="images/partial-curve.png" width="141" height="142"
					     alt="The curved corner is an arc from the top left corner
					          sweeping across the top right corner to the bottom right corner,
					          describing a quarter-ellipse;
					          but since the opposite sides have a border thickness
					          the padding edge curve starts inward from the outer arc's endpoints."
					>
		</table>
		<figcaption>
		Where the border-radius curve extends into the opposite sides' borders,
		the arc of the padding edge is less than 90&deg;.
		</figcaption>
	</figure>

	The [=margin edge=], being outside the [=border edge=],
	calculates its radius by <em>adding</em> the corresponding margin thickness
	to each border radius, with the corresponding [=outset-adjusted border radius=] applied.

	<wpt>
		background-clip-content-box-with-border-radius-002.html
		background-clip-content-box-with-border-radius-003.html
		background-clip-padding-box-with-border-radius-002.html
		background-clip-padding-box-with-border-radius-003.html
	</wpt>

<div algorithm="border-radius-outset">

	When expanding an [=edge=] that has a [=border radius=], e.g. for computing the [=margin edge=], 'box-shadow' spread, or 'overflow-clip-margin',
	the different [=border radius=] values are adjusted so that a small rounded corner with a big outset does not appear to be disproportionally round.

	This is done by computing the corresponding [=outset-adjusted border radius=].

	To compute the <dfn export>outset-adjusted border radius</dfn> given the 2-dimensional [=size=]'s |edge|, |radius|, and |outset|:
		1. Let |coverage| be <code>2 * min(|radius|'s [=width=] / |edge|'s [=width=], |radius|'s [=height=] / |edge|'s [=height=])</code>.
		1. Let |adustedRadiusWidth| be the [=adjusted radius dimension=] given |coverage|, |radius|'s [=width=], and |outset|'s [=width=].
		1. Let |adustedRadiusHeight| be the [=adjusted radius dimension=] given |coverage|, |radius|'s [=height=], and |outset|'s [=height=].
		1. Return (|adustedRadiusWidth|, |adustedRadiusHeight|).

	To compute the <dfn>adjusted radius dimension</dfn> given numbers |coverage|, |radius|, and |outset|:
		1. If |radius| is greater than |spread|, or if |coverage| is greater than 1, then return <code>|radius| + |outset|</code>.
		1. Let |ratio| be <code>|radius| / |outset|</code>.
		1. Return <code>|radius| + |outset| * (1 - (1 - |ratio|)<sup>3</sup> * (1 - |coverage|<sup>3</sup>))</code>.

		Note: this algorithm is designed to reduce the effect of the |outset| (or spread) on the shape of the corner.
		The |coverage| factor makes this reduction more pronounced for rectangular shapes (where the [=border radius=] is close to 0),
		and less pronounced for elliptical shapes (where the [=border radius=] is close to 50%).
</div>


<h3 id="corner-clipping">
Corner Clipping</h3>

	Although <a href="#border-image">border images</a>
	are not affected by 'border-radius',
	other effects that clip painting or event handling
	to the [=border edge|border=], [=padding edge|padding=], or [=content edge|content=] edge
	must clip to their respective curves.
	For example,
	backgrounds clip to the curve specified by 'background-clip',
	'overflow' values other than ''visible'' to the curved [=padding edge=]
	(when 'overflow' on both axes is not ''visible''),
	[=replaced element=] content to the curved [=content edge=],
	pointer events to the curved [=border edge=],
	etc.

	Note: As 'border-radius' reduces the interactive area of an element
	authors should make sure the remaining interactive area conforms
	to recommended minima for the platforms they target;
	in particular, conforming to recommended minimum touch target sizes
	may require larger widths and heights when 'border-radius' is used.

	<div class=example>
		This example adds appropriate padding,
		so that the contents do not overflow the corners.
		Note that there is no border,
		but the background will still have rounded corners.

		<pre>
		DIV {
		    background: black;
		    color: white;
		    border-radius: 1em;
		    padding: 1em }
		</pre>
	</div>

<h3 id="corner-transitions">
Color and Style Transitions</h3>

	Color and style transitions must be contained
	within the segment of the border that intersects
	the smallest rectangle that contains both border radii
	as well as the center of the inner curve
	(which may be a point representing the corner of the padding edge,
	if the border radii are smaller than the [=border width=]).

	If one of these borders is zero-width,
	then the other border takes up the entire transitional area.
	Otherwise,
	the center of color and style transitions between adjoining borders
	is a point along the curve that is a continuous monotonic function
	of the ratio of the border widths.
	However it is not defined what these transitions look like
	or what function maps from this ratio to a point on the curve.

	<figure>
		<img src="images/transition-region.png" width="600" height="178"
		     alt=""
		>

		<figcaption>
			Given these corner shapes, color and style transitions
			must be contained within the green region.
			In case D the rectangle defined by the border radii
			does not include the center of the inner curve (which is a sharp corner),
			so the transition region is expanded to include that corner.
			Transitions may take up the entire transition region,
			but are not required to:
			For example, a gradient color transition between two solid border styles
			might take up only the region bounded by
			the tips of the outer radii and the tips of the inner radii
			(represented in case D by the dark green region).
		</figcaption>
	</figure>

<h3 id="corner-overlap">
Overlapping Curves</h3>

	Corner curves must not overlap:
	When the sum of any two adjacent border radii
	exceeds the size of the border box,
	UAs must proportionally reduce
	the used values of all border radii
	until none of them overlap.
	The algorithm for reducing radii is as follows:

	Let <var>f</var> = min(<var>L<sub>i</sub></var>/<var>S<sub>i</sub></var>),
	where <var>i</var> ∈ {top, right, bottom, left},
	<var>S<sub>i</sub></var> is the sum of the two corresponding radii
	of the corners on side <var>i</var>,
	and <var>L<sub>top</sub></var> = <var>L<sub>bottom</sub></var> = the width of the box,
	and <var>L<sub>left</sub></var> = <var>L<sub>right</sub></var> = the height of the box.
	If <var>f</var> &lt; 1, then all corner radii are reduced
	by multiplying them by <var>f</var>.

	Note: This formula ensures that quarter circles remain quarter circles
	and large radii remain larger than smaller ones,
	but it may reduce corners that were already small enough,
	which may make borders of nearby elements that should look the same
	look different.

	If the curve interferes with UI elements such as scrollbars,
	the UA may further reduce the used value of the affected border radii
	(and only the affected border radii)
	as much as necessary, but no more.

	<div class=example>
		For example, the borders A of the <a href="#reduced-radius">figure below</a>
		might be the result of

		<pre>
		box-sizing: border-box;
		width: 6em;
		height: 2.5em;
		border-radius: 0.5em 2em 0.5em 2em
		</pre>

		The height (2.5em) is enough for the specified radii (0.5em plus 2.0em).
		However, if the height is only 2em,

		<pre>
		box-sizing: border-box;
		width: 6em;
		height: 2em;
		border-radius: 0.5em 2em 0.5em 2em
		</pre>

		all corners need to be reduced by a factor 0.8 to make them fit.
		The used border radii thus are
		0.4em (instead of 0.5em) and 1.6em (instead of 2em).
		See borders B in the figure.

		<figure id=reduced-radius>
			<img src="images/corner-large-mix.png" width="539" height="168"
			     alt="rectangle with two tiny rounded corners and two very large ones, on opposite corners"
			>

			<figcaption>
				These rounded corner might be the result of
				''width: 6em; height: 2.5em; border-radius: 0.5em 2em 0.5em 2em''
				for A; and ditto but with ''height: 2em'' for B.
			</figcaption>
		</figure>
	</div>

<h3 id="border-radius-tables">
Effect on Tables</h3>

	The 'border-radius' properties do apply to
	''display/table'', ''inline-table'', and ''table-cell'' boxes
	in separated borders mode (''border-collapse: separate'').
	When 'border-collapse' is ''border-collapse/collapse'', they have no effect.

	<wpt>
		table-cell-background-local-002.html
		table-cell-background-local-003.html
		table-cell-background-local.html
		ttwf-reftest-borderRadius.html
	</wpt>

<h2 id="border-images">
Border Images</h2>

	Authors can specify an image to be used in place of the border styles.
	In this case, the border's design is taken from the sides and corners
	of an image specified with 'border-image-source',
	whose pieces may be sliced, scaled, and stretched in various ways
	to fit the size of the [=border image area=].
	The border-image properties do not affect layout:
	layout of the box, its content, and surrounding content
	is based on the 'border-width' and 'border-style' properties only.

	<div class=example>
		This example creates
		a top and bottom border consisting of a whole number of orange diamonds
		and a left and right border of a single, stretched diamond.
		The corners are diamonds of a different color.
		The image to tile is as follows.
		Apart from the diamonds, it is transparent:

		<img src="images/border.png" width="81" height="81"
		     alt="Tile for border"
		>

		The image is 81 by 81 pixels and has to be divided into 9 equal parts.
		The style rules could thus be as follows:

		<pre>
		DIV {
		  border: double orange 1em;
		  border-image: url("border.png") 27 round stretch;
		 }
		</pre>

		The result, when applied to a DIV of 12 by 5em,
		will be similar to this:

		<img src="images/borderresult.png" width="239" height="116"
		     alt="Element with a diamond border"
		>
	</div>

	<div class="example">
		This shows a more complicated example,
		demonstrating how the border image corresponds to the fallback border-style
		but can also extend beyond the border area.
		The border image is a wavy green border with an extended corner effect:

		<figure>
			<img src="images/groovy-border-image-slice.png" width="396" height="375"
			     alt="Diagram: The border image shows a wavy green border
			          with more exaggerated waves towards the corners,
			          which are capped by a disconnected green circle.
			          Four cuts at 124px offsets from each side
			          divide the image into 124px-wide square corners,
			          124px-wide but thin side slices,
			          and a small center square."
			>

			<figcaption>
				The 'border-image-source' image,
				with the four 'border-image-slice' cuts at 124px
				dividing the image into nine parts.
			</figcaption>
		</figure>

		The rest of the border properties then interact
		to lay out the tiles as follows:

		<figure>
			<img src="images/border-image.png" width="452" height="537"
			     alt="Diagram: The image-less (fallback) rendering
			          has a green double border.
			          The rendering with border-image shows the wavy green border,
			          ith the waves getting longer as they reach the corners.
			          The corner tiles render as 124px-wide squares
			          and the side tiles repeat a whole number of times
			          to fill the space in between.
			          Because of the gradual corner effects,
			          the tiles extend deep into the padding area.
			          The whole border image effect is outset 31px,
			          so that the troughs of the waves align
			          just outside the padding edge."
			>

			<figcaption>
				Diagram of all border-image properties and how they interact,
				and showing the rendering with and without the border-image in effect.
			</figcaption>
		</figure>

		Here, even though the 'border-width' is 12px,
		the 'border-image-width' property computes to 124px.
		The [=border image area=] is then outset 31px from the [=border box=]
		and into the [=margin area=].
		If the border-image fails to load
		(or if border images are not supported by the UA),
		the fallback rendering uses a green double border.
	</div>

	<div class="example" id="border-image-border-shorthand-example">
		Notice that the 'border' shorthand resets 'border-image'.
		This makes it easy to turn off or reset all border effects:

		<pre>
		.notebox {
		  border: double orange;
		  /* must set 'border' shorthand first, otherwise it erases 'border-image' */
		  border-image: url("border.png") 30 round;
		  /* but other 'border' properties can be set after */
		  border-width: thin thick;
		}
		...
		.sidebar .notebox {
		  box-shadow: 0 0 5px gray;
		  border-radius: 5px;
		  border: none; /* turn off all borders */
		  /* 'border' shorthand resets 'border-image' */
		}
		</pre>
	</div>

	<wpt>
		border-image-021.html
		border-image-outset-004.html
	</wpt>

<h3 id="border-image-source" oldids="the-border-image-source">
Image Source: the 'border-image-source' property</h3>

	<pre class=propdef>
	Name: border-image-source
	Value: none | <<image>>
	Initial: none
	Applies to: All elements, except internal table elements when 'border-collapse' is ''border-collapse/collapse''
	Inherited: no
	Percentages: N/A
	Computed value: the keyword ''border-image-source/none'' or the computed <<image>>
	Animation type: discrete
	</pre>

	<wpt>
		animations/border-image-source-interpolation.html
		css3-border-image-source.html
		parsing/border-image-source-computed.sub.html
		parsing/border-image-source-invalid.html
		parsing/border-image-source-valid.html
	</wpt>

	Specifies an image to use as a border
	in place of the rendering specified by the 'border-style' properties
	and, if given the ''fill'' keyword in 'border-image-slice',
	as an additional image backdrop for the element.
	If the value is ''border-image-source/none'' or if the image cannot be displayed
	(or the property doesn't apply), the border styles will be used;
	otherwise the element's 'border-style' borders are not drawn
	and this <dfn export id="border-image-dfn">border image</dfn> is drawn
	as described in the sections below.

<h3 id="border-image-slice" oldids="the-border-image-slice">
Image Slicing: the 'border-image-slice' property</h3>

	<pre class=propdef>
	Name: border-image-slice
	Value: [<<number [0,∞]>> | <<percentage [0,∞]>>]{1,4} &amp;&amp; fill?
	Initial: 100%
	Applies to: All elements, except internal table elements when 'border-collapse' is ''border-collapse/collapse''
	Inherited: no
	Percentages: refer to size of the border image
	Computed value: four values, each either a number or percentage; plus a ''fill'' keyword if specified
	Animation type: by computed value
	</pre>

	<wpt>
		animations/border-image-slice-composition.html
		animations/border-image-slice-interpolation-stability.html
		animations/border-image-slice-interpolation.html
		border-image-slice-001.xht
		border-image-slice-002.xht
		border-image-slice-003.xht
		border-image-slice-004.htm
		border-image-slice-005.htm
		border-image-slice-006.htm
		border-image-slice-007.htm
		border-image-slice-fill-001.html
		border-image-slice-fill-002.html
		border-image-slice-fill-003.html
		border-image-slice-percentage.html
		border-image-slice-shorthand-reset.html
		parsing/border-image-slice-computed.html
		parsing/border-image-slice-invalid.html
		parsing/border-image-slice-valid.html
	</wpt>

	This property specifies inward offsets from
	the top, right, bottom, and left edges of the image,
	dividing it into nine regions: four corners, four edges and a middle.
	The middle image part is discarded (treated as fully transparent)
	unless the ''fill'' keyword is present.
	(It is drawn over the background;
	see <a href="#border-image-process">Drawing the Border Image</a>.)

	If there is only one component value,
	it applies to all sides.
	If there are two values,
	the top and bottom are set to the first value
	and the right and left are set to the second.
	If there are three values,
	the top is set to the first value,
	the left and right are set to the second,
	and the bottom is set to the third.
	If there are four values
	they apply to the top, right, bottom, and left, respectively.

	<dl dfn-for=border-image-slice dfn-type=value>
		<dt><dfn><<percentage [0,∞]>></dfn>
		<dd>
			Percentages are relative to the size of the image:
			the width of the image for the horizontal offsets,
			the height for vertical offsets.

		<dt><dfn><<number [0,∞]>></dfn>
		<dd>
			Numbers represent pixels in the image
			(if the image is a raster image)
			or vector coordinates
			(if the image is a vector image).

		<dt><dfn id="border-image-slice-fill">fill</dfn>
		<dd>
			The ''fill'' keyword, if present,
			causes the middle part of the border-image to be preserved.
			(By default it is discarded, i.e., treated as empty.)
	</dl>

	Negative values are invalid.
	Computed values larger than the size of the image are interpreted as ''100%''.

	The regions given by the 'border-image-slice' values may overlap.
	However if the sum of the right and left widths
	is equal to or greater than the width of the image,
	the images for the top and bottom edge and the middle part are empty--
	which has the same effect as if a nonempty transparent image
	had been specified for those parts.
	Analogously for the top and bottom values.

	If the image must be sized to determine the slices
	(for example, for SVG images with no [=natural dimensions=]),
	then it is sized using the <a href="https://www.w3.org/TR/css3-images/#default-sizing">default sizing algorithm</a>
	with no [=specified size=] and the [=border image area=] as the [=default object size=].

	<figure>
		<img src="images/slice.png" width="388" height="304"
		     alt="Diagram: two horizontal cuts and two vertical cuts through an image"
		>

		<figcaption>
			Diagram illustrating the cuts corresponding to the value ''25% 30% 12% 20%''
		</figcaption>
	</figure>

<h3 id="border-image-width" oldids="the-border-image-width">
Drawing Areas: the 'border-image-width' property</h3>

	<pre class=propdef>
	Name: border-image-width
	Value: [ <<length-percentage [0,∞]>> | <<number [0,∞]>> | auto ]{1,4}
	Initial: 1
	Applies to: All elements,
		except internal table elements when 'border-collapse' is ''border-collapse/collapse''
	Inherited: no
	Percentages: Relative to width/height of the [=border image area=]
	Computed value: four values,
		each either a number,
		the keyword ''border-image-width/auto'',
		or a computed <<length-percentage>> value
	Animation type: by computed value
	</pre>

	<wpt>
		border-image-width-001.htm
		border-image-width-005.xht
		border-image-width-006.xht
		border-image-width-007.xht
		border-image-width-008.html
		border-image-width-009.html
		border-image-width-should-extend-to-padding.html
		parsing/border-image-width-computed.html
		parsing/border-image-width-invalid.html
		parsing/border-image-width-valid.html
	</wpt>

	The [=border image=] is drawn inside an area called the <dfn export>border image area</dfn>.
	This is an area whose boundaries by default correspond to the [=border box=],
	see 'border-image-outset'.

	The four values of 'border-image-width' specify offsets
	that are used to divide the [=border image area=] into nine
	<dfn export lt="border image region" local-lt="region">regions</dfn>.
	The offsets represent inward distances from
	the top, right, bottom, and left sides of the area, respectively.

	If there is only one component value,
	it applies to all sides.
	If there are two values,
	the top and bottom are set to the first value
	and the right and left are set to the second.
	If there are three values,
	the top is set to the first value,
	the left and right are set to the second,
	and the bottom is set to the third.
	If there are four values
	they apply to the top, right, bottom, and left, respectively.

	Values have the following meanings:

	<dl dfn-for=border-image-width dfn-type=value>
		<dt><dfn><<length-percentage [0,∞]>></dfn>
		<dd>
			Percentages refer to the size of the [=border image area=]:
			the width of the area for horizontal offsets,
			the height for vertical offsets.

		<dt><dfn><<number [0,∞]>></dfn>
		<dd>
			Numbers represent multiples of the corresponding computed
			<a href="#border-width">border-width</a>.

		<dt><dfn>auto</dfn>
		<dd>
			If ''border-image-width/auto'' is specified
			then the used 'border-image-width' is
			the [=natural size|natural=] width or height (whichever is applicable)
			of the corresponding image slice (see 'border-image-slice').
			If the image does not have the required [=natural dimension=]
			then the corresponding computed 'border-width' is used instead.
	</dl>

	Negative values are invalid for any 'border-image-width' values.

	If two opposite 'border-image-width' offsets are large enough that they overlap,
	then the [=used values=] of all 'border-image-width' offsets
	are proportionally reduced until they no longer overlap.
	In mathematical notation:
	Given <var>L<sub>width</sub></var>
	as the width of the [=border image area=],
	<var>L<sub>height</sub></var>
	as its height,
	and <var>W<sub><var>side</var></sub></var>
	as the 'border-image-width' offset for the <var>side</var> side,
	let <var>f</var> = min(<var>L<sub>width</sub></var>/(<var>W<sub>left</sub></var>+<var>W<sub>right</sub></var>),
	<var>L<sub>height</sub></var>/(<var>W<sub>top</sub></var>+<var>W<sub>bottom</sub></var>)).
	If <var>f</var> &lt; 1,
	then all <var>W</var> are reduced by multiplying them by <var>f</var>.

<h3 id="border-image-outset" oldids="the-border-image-outset">
Edge Overhang: the 'border-image-outset' property</h3>

	<pre class=propdef>
	Name: border-image-outset
	Value: [ <<length [0,∞]>> | <<number [0,∞]>> ]{1,4}
	Initial: 0
	Applies to: All elements, except internal table elements when 'border-collapse' is ''border-collapse/collapse''
	Inherited: no
	Percentages: N/A
	Computed value: four values, each a number or absolute length
	Animation type: by computed value
	</pre>

	<wpt>
		animations/border-image-outset-composition.html
		animations/border-image-outset-interpolation.html
		border-image-outset-003.html
		parsing/border-image-outset-computed.html
		parsing/border-image-outset-invalid.html
		parsing/border-image-outset-valid.html
	</wpt>

	The values specify the amount by which the [=border image area=]
	extends beyond the [=border box=].

	If there is only one component value,
	it applies to all sides.
	If there are two values,
	the top and bottom are set to the first value
	and the right and left are set to the second.
	If there are three values,
	the top is set to the first value,
	the left and right are set to the second,
	and the bottom is set to the third.
	If there are four values
	they apply to the top, right, bottom, and left, respectively.

	<dl dfn-for=border-image-outset dfn-type=value>
		<dt><<length [0,∞]>>
		<dd>
			Represents an outset of the specified length.

		<dt><<number [0,∞]>>
		<dd>
			Represents an outset of the specified multiple of
			the corresponding computed <a href="#border-width">border-width</a>.
	</dl>

	Negative values are invalid.

	Portions of the border-image that are rendered outside the [=border box=]
	are [=ink overflow=] and
	do not trigger scrolling.
	Also such portions are invisible to mouse events
	and do not capture such events on behalf of the element.

	Note: Even though they never cause a scrolling mechanism,
	outset images may still be clipped by an ancestor or by the viewport.

<h3 id="border-image-repeat" oldids="the-border-image-repeat">
Image Tiling: the 'border-image-repeat' property</h3>

	<pre class=propdef>
	Name: border-image-repeat
	Value: [ stretch | repeat | round | space ]{1,2}
	Initial: stretch
	Applies to: All elements, except internal table elements when 'border-collapse' is ''border-collapse/collapse''
	Inherited: no
	Percentages: N/A
	Computed value: two keywords, one per axis
	Animation type: discrete
	</pre>

	<wpt>
		animations/discrete-no-interpolation.html
		border-image-repeat-002.htm
		border-image-repeat-004.htm
		border-image-repeat-005.html
		border-image-repeat-1.html
		border-image-repeat-repeat-001.html
		border-image-repeat-round-003.html
		border-image-repeat-round-1.html
		border-image-repeat-round-2.html
		border-image-repeat-round-stretch-001.html
		border-image-repeat-round.html
		border-image-repeat-space-011.html
		border-image-repeat-space-1.html
		border-image-repeat-space-10.html
		border-image-repeat-space-2.html
		border-image-repeat-space-3.html
		border-image-repeat-space-4-ref-1.html
		border-image-repeat-space-4.html
		border-image-repeat-space-5-ref-1.html
		border-image-repeat-space-5.html
		border-image-repeat-space-6.html
		border-image-repeat-space-7.html
		border-image-repeat-space-8.html
		border-image-repeat-space-9.html
		border-image-repeat-stretch-round-001.html
		border-image-repeat_repeatnegx_none_50px.html
		css3-border-image-repeat-repeat.html
		css3-border-image-repeat-stretch.html
		parsing/border-image-repeat-computed.html
		parsing/border-image-repeat-invalid.html
		parsing/border-image-repeat-valid.html
	</wpt>

	This property specifies how the images for the sides
	and the middle part of the [=border image=]
	are scaled and tiled.
	The first keyword applies to the horizontal scaling and tiling
	of the top, middle and bottom parts,
	the second to the vertical scaling and tiling
	of the left, middle and right parts;
	see <a href="#border-image-process">Drawing the Border Image</a>.
	If the second keyword is absent, it is assumed to be the same as the first.
	Values have the following meanings:

	<dl dfn-for=border-image-repeat dfn-type=value>
		<dt><dfn>stretch</dfn></dt>
		<dd>
			The image is stretched to fill its corresponding [=region=].
		<dt><dfn>repeat</dfn></dt>
		<dd>
			The image is tiled (repeated) to fill its corresponding [=region=].
		<dt><dfn>round</dfn></dt>
		<dd>
			The image is tiled (repeated) to fill its corresponding [=region=].
			If it does not fill the area with a whole number of tiles,
			the image is rescaled so that it does.
		<dt><dfn>space</dfn></dt>
		<dd>
			The image is tiled (repeated) to fill its corresponding [=region=].
			If it does not fill the region with a whole number of tiles,
			the extra space is distributed around the tiles.
	</dl>

	The exact process for scaling and tiling the border-image parts
	is given in the section below.

<h3 id="border-image-process">
Drawing the Border Image</h3>

	After the [=border image=] given by 'border-image-source'
	is sliced by the 'border-image-slice' values,
	the resulting nine images are scaled, positioned, and tiled
	into their corresponding [=border image regions=] in four steps:

	<ol>
	<li>Scale to 'border-image-width'.
		<ul>
		<li>The two images for the top and bottom edges are made as tall
			as the top and bottom [=border image regions=], respectively,
			and their width is scaled proportionally.

		<li>The images for the left and right edges are made as wide
			as the left and right [=border image regions=], respectively,
			and their height is scaled proportionally.

		<li>The corner images are scaled to be as wide and as tall
			as the their respective [=border image regions=].

		<li>The middle image's width is scaled by the same factor as the top image
			unless that factor is zero or infinity,
			in which case the scaling factor of the bottom is substituted,
			and failing that, the width is not scaled.
			The height of the middle image is scaled by the same factor as the left image
			unless that factor is zero or infinity,
			in which case the scaling factor of the right image is substituted,
			and failing that, the height is not scaled.
		</ul>

	<li>Scale to 'border-image-repeat'.
		<ul>
		<li>If the first keyword is ''border-image-repeat/stretch'',
			the top, middle and bottom images are further scaled
			to be as wide as the middle region of the [=border image area=].
			The height is not changed any further.

		<li>If the first keyword is ''border-image-repeat/round'',
			the top, middle and bottom images are resized in width,
			so that exactly a whole number of them fit
			in the middle region of the [=border image area=],
			exactly as for ''background-repeat/round'' in the 'background-repeat' property.

		<li>If the first keyword is ''border-image-repeat/repeat'' or ''border-image-repeat/space'',
			the top, middle, and bottom images are not changed any further.

		<li>The effects of ''border-image-repeat/stretch'', ''border-image-repeat/round'', ''border-image-repeat/repeat'', and ''border-image-repeat/space''
			for the second keyword are analogous,
			acting on the height of the left, middle and right images.
		</ul>

	<li>Position the first tile.
		<ul>
		<li>If the first keyword is ''border-image-repeat/repeat'',
			the top, middle, and bottom images
			are centered horizontally in their respective regions.
			Otherwise the images are placed at the left edge
			of their respective regions of the [=border image area=].

		<li>If the second keyword is ''border-image-repeat/repeat'',
			the left, middle, and right images
			are centered vertically in their respective regions.
			Otherwise the images are placed at the top edge
			of their respective regions of the [=border image area=].
		</ul>

	<li>Tile and draw.
		<ul>
		<li>The images are then tiled to fill their respective regions.

		<li>In the case of ''border-image-repeat/space'',
			any partial tiles are discarded and the extra space distributed
			before, after, and between the tiles.
			(I.e. the gap before the first tile,
			the gap after the last tile,
			and the gaps between tiles are equalized.)
			<span class="note">This can result in empty border-image side regions.</span>

		<li>The images are drawn at the same stacking level as normal borders:
			immediately in front of the background layers.

		<li>The middle image is not drawn
			unless ''fill'' was specified for 'border-image-source'.
		</ul>
	</ol>

<h3 id="border-image" oldids="the-border-image">
Border Image Shorthand: the 'border-image' property</h3>

	<pre class=propdef>
	Name: border-image
	Value: <<'border-image-source'>> || <<'border-image-slice'>> [ / <<'border-image-width'>> | / <<'border-image-width'>>? / <<'border-image-outset'>> ]? || <<'border-image-repeat'>>
	Initial: See individual properties
	Applies to: See individual properties
	Inherited: no
	Percentages: N/A
	Computed value: See individual properties
	Animation Type: See individual properties
	</pre>

	<wpt>
		border-image-002.html
		border-image-003.html
		border-image-004.html
		border-image-006.html
		border-image-007.html
		border-image-011.html
		border-image-012.html
		border-image-013.html
		border-image-017.xht
		border-image-018.xht
		border-image-019.xht
		border-image-020.xht
		border-image-calc.html
		border-image-image-type-001.htm
		border-image-image-type-002.htm
		border-image-image-type-003.htm
		border-image-image-type-004.htm
		border-image-image-type-005.htm
		border-image-round-and-stretch.html
		border-image-shorthand-001.htm
		border-image-shorthand-002.htm
		border-image-shorthand-003.htm
		border-image-space-001.html
		parsing/border-image-invalid.html
		parsing/border-image-shorthand.sub.html
		parsing/border-image-valid.html
	</wpt>

	This is a shorthand property for setting
	'border-image-source',
	'border-image-slice',
	'border-image-width',
	'border-image-outset',
	and 'border-image-repeat'
	in a single declaration.
	Omitted values are set to their [=initial values=].

<h3 id=border-image-tables>Effect on Tables</h3>

	The 'border-image' properties apply
	to the border of tables and inline tables
	that have 'border-collapse' set to ''border-collapse/collapse''.
	However, this specification does not define
	how such an image border is rendered.
	In particular, it does not define how the image border interacts
	with the borders of cells, rows and row groups at the edges of the table
	(see <a href="https://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#border-conflict-resolution">border conflict resolution</a> in [[!CSS2]]).

	It is expected that a future specification will define the rendering.
	It is recommended that UAs do not apply border images
	to tables with collapsed borders until then.


<h2 id="misc">Miscellaneous Effects</h2>

	Note: The 'box-decoration-break' property,
	which defines how backgrounds and borders apply to a fragmented box,
	has been moved to the <a href="https://www.w3.org/TR/css-break/">CSS Fragmentation Module</a>. [[CSS-BREAK-3]]

<h3 id="box-shadow" oldids="the-box-shadow">Drop Shadows: the 'box-shadow' property</h3>

	<pre class=propdef>
	Name: box-shadow
	Value: none | <<shadow>>#
	Initial: none
	Applies to: all elements
	Inherited: no
	Percentages: N/A
	Computed value: either the keyword ''box-shadow/none'' or a list,
		each item consisting of four absolute lengths
		plus a computed color and optionally also a ''box-shadow/inset'' keyword
	Animation type: by computed value,
		treating ''box-shadow/none'' as a zero-item list
		and appending blank shadows (''transparent 0 0 0 0'')
		with a corresponding ''box-shadow/inset'' keyword as needed
		to match the longer list
		if the shorter list is otherwise compatible with the longer one
	</pre>

	<wpt>
		animations/box-shadow-composition.html
		animations/box-shadow-interpolation.html
		box-shadow-005.html
		box-shadow-029.html
		box-shadow-039.html
		box-shadow-040.html
		box-shadow-041.html
		box-shadow-042.html
		box-shadow-body.html
		box-shadow-border-radius-001.html
		box-shadow-calc.html
		box-shadow-currentcolor.html
		box-shadow-inset-without-border-radius.html
		box-shadow-invalid-001.html
		box-shadow-multiple-001.html
		box-shadow-outset-without-border-radius-001.html
		box-shadow-overlapping-001.html
		box-shadow-overlapping-002.html
		box-shadow-overlapping-003.html
		box-shadow-overlapping-004.html
		box-shadow-radius-000.html
		box-shadow-radius-001.html
		box-shadow-table-border-collapse-001.html
		box-shadow/slice-block-fragmentation-001.html
		box-shadow/slice-block-fragmentation-002.html
		box-shadow/slice-block-fragmentation-003.html
		box-shadow/slice-inline-fragmentation-001.html
		box-shadow/slice-inline-fragmentation-002.html
		box-shadow/slice-inline-fragmentation-003.html
		css-box-shadow-001.html
		css3-box-shadow.html
		fieldset-inset-shadow.html
		inset-box-shadow-scroll.html
		inset-box-shadow-stacking-context-scroll.html
		inheritance.sub.html
		parsing/box-shadow-computed.html
		parsing/box-shadow-invalid.html
		parsing/box-shadow-valid.html
	</wpt>

	The 'box-shadow' property attaches one or more drop shadows to the box.
	The property accepts either
	the <dfn value for=box-shadow id="box-shadow-none">none</dfn> value,
	which indicates no shadows,
	or a comma-separated list of shadows, ordered front to back.

	Each shadow is given as a <<shadow>>,
	represented by 2-4 length values, an optional color, and an optional ''box-shadow/inset'' keyword.
	Omitted lengths are 0; omitted colors default to ''currentColor''.
	<pre class=prod>
	<dfn><<shadow>></dfn> = <<color>>? &amp;&amp; [ <<length>>{2} [ <<length [0,∞]>> <<length>>? ]? ] &amp;&amp; inset?</pre>

	The components of each <<shadow>> are interpreted as follows:

	<dl dfn-type=dfn dfn-for=box-shadow noexport>
		<dt><dfn id="shadow-offset-x">1st <<length>></dfn>
		<dd>
			Specifies the <dfn export>horizontal offset</dfn> of the shadow.
			A positive value draws a shadow that is offset to the right of the box,
			a negative length to the left.

		<dt><dfn id="shadow-offset-y">2nd <<length>></dfn>
		<dd>
			Specifies the <dfn export>vertical offset</dfn> of the shadow.
			A positive value offsets the shadow down, a negative one up.

		<dt><dfn id="shadow-blur-radius">3rd <<length [0,∞]>></dfn>
		<dd>Specifies the <dfn export>blur radius</dfn>.
			Negative values are invalid.
			If the blur value is zero, the shadow’s edge is sharp.
			Otherwise, the larger the value, the more the shadow’s edge is blurred.
			See <a href="#shadow-blur">Shadow Blurring</a>, below.

		<dt><dfn id="shadow-spread-distance">4th <<length>></dfn>
		<dd>Specifies the <dfn export>spread distance</dfn>.
			Positive values cause the shadow to expand in all directions by the specified radius.
			Negative values cause the shadow to contract.
			See <a href="#shadow-shape">Shadow Shape</a>, below.
			<p class="note">Note that for inner shadows,
			expanding the shadow (creating more shadow area)
			means contracting the shadow’s perimeter shape.

		<dt><dfn value id="shadow-color"><<color>></dfn>
		<dd>
			Specifies the color of the shadow.
			If the color is absent, it defaults to ''currentColor''.

		<dt><dfn value id="shadow-inset">inset</dfn>
		<dd>
			If present, the ''box-shadow/inset'' keyword changes the drop shadow
			from an <dfn local-lt="outer shadow" export>outer box-shadow</dfn>
			(one that shadows the box onto the canvas,
			as if it were lifted above the canvas)
			to an <dfn local-lt="inner shadow" export>inner box-shadow</dfn>
			(one that shadows the canvas onto the box,
			as if the box were cut out of the canvas and shifted behind it).
	</dl>

	<div class="example">
		The example below demonstrates the effects of spread and blur on the shadow:
		<pre>
		width: <b>100px</b>; height: <b>100px</b>;
		border: <b>12px solid blue</b>; background-color: <b>orange</b>;
		border-top-left-radius: <b>60px 90px</b>;
		border-bottom-right-radius: <b>60px 90px</b>;
		box-shadow: <b>64px 64px 12px 40px rgba(0,0,0,0.4),
		            12px 12px 0px 8px rgba(0,0,0,0.4) inset</b>;
		</pre>
		<figure>
			<img src="images/spread-blur.png" width="251" height="244"
			     alt="The sample code above would create a 100px&times;100px orange box with a 12px blue border,
			          whose top right / bottom left corners are sharp and tob left / bottom right corners are elliptically curved.
			          Two shadows are created: an inner one, which due to its offset and spread creates a 20px-wide band of darker orange along the top and left sides of the box (curving to match the rounded top left border shape);
			          and an outer one, creating a 204px&times;204px gray duplicate of the shape seemingly behind the box,
			          offset 24px down and 24px to the right of the box's top and left edges.
			          Applying the 12px blur radius to the outer shadow creates a gradual shift from the shadow color to transparent along its edges
			          which is visibly apparent for 24px centered along the edge of the shadow."
			>
		</figure>
	</div>

<h4 id="shadow-shape">
Shadow Shape, Spread, and Knockout</h4>

	An [=outer box-shadow=] casts a shadow
	as if the border-box of the element were opaque.
	Assuming a spread distance of zero, its perimeter has
	the exact same size and shape as the border box.
	The shadow is drawn outside the border edge only:
	it is clipped inside the border-box of the element.

	An [=inner box-shadow=] casts a shadow
	as if everything outside the padding edge were opaque.
	Assuming a spread distance of zero, its perimeter has
	the exact same size and shape as the padding box.
	The shadow is drawn inside the padding edge only:
	it is clipped outside the padding box of the element.

	If a [=spread distance=] is defined,
	the shadow perimeter defined above
	is expanded outward (for [=outer box-shadows=])
	or contracted inward (for [=inner box-shadows=])
	by outsetting (insetting, for inner shadows)
	the shadow's straight edges by the [=spread distance=]
	(and flooring the resulting width/height at zero).

	<div class="example">
		Below are some examples of an orange box with a blue border
		being given a drop shadow.

		<table class="data" id="box-shadow-samples">
			<tr>
				<th scope="rowgroup">
					<pre><code>
					border:5px solid blue;
					background-color:orange;
					width: 144px;
					height: 144px;
					</code></pre>
				<th>
					<pre><code>border-radius: 20px;</code></pre>
				<th>
					<pre><code>border-radius: 0;</code></pre>
			<tr>
				<th>
					<pre><code>
					box-shadow:
					  rgba(0,0,0,0.4)
					  10px 10px;
					</code></pre>
				<td>
					<img src="images/shadow-outer-round.png" width="175" height="175"
					     alt="A round-cornered box with a light gray shadow the same shape
					          as the border box offset 10px to the right and 10px down
					          from directly underneath the box."
					>
				<td>
					<img src="images/shadow-outer-square.png" width="175" height="175"
					     alt="A square-cornered box with a light gray shadow the same shape
					          as the border box offset 10px to the right and 10px down
					          from directly underneath the box."
					>
			<tr>
				<th>
					<pre><code>
					box-shadow:
					  rgba(0,0,0,0.4)
					  10px 10px
					  inset
					</code></pre>
				<td>
					<img src="images/shadow-inner-round.png" width="175" height="175"
					     alt="A round-cornered box with a light gray shadow the inverse shape
					          of the padding box filling 10px in from the top and left edges
					          (just inside the border)."
					>
				<td>
					<img src="images/shadow-inner-square.png" width="175" height="175"
					     alt="A square-cornered box with a light gray shadow the inverse shape
					          of the padding box filling 10px in from the top and left edges
					          (just inside the border)."
					>
			<tr>
				<th>
					<pre><code>
					box-shadow:
					  rgba(0,0,0,0.4)
					  10px 10px 0
					  10px /* spread */
					</code></pre>
				<td>
					<img src="images/shadow-outer-spread-round.png" width="175" height="175"
					     alt="A round-cornered box with a light gray shadow the same shape
					          as the box but 20px taller and wider and offset so that the
					          top and left edges of the shadow are directly underneath the
					          top and left edges of the box."
					>
				<td>
					<img src="images/shadow-outer-spread-square.png" width="175" height="175"
					     alt="A square-cornered box with a light gray shadow the same shape
					          as the box but 20px taller and wider and offset so that the
					          top and left edges of the shadow are directly underneath the
					          top and left edges of the box."
					>
			<tr>
				<th>
					<pre><code>
					box-shadow:
					  rgba(0,0,0,0.4)
					  10px 10px 0
					  10px /* spread */
					  inset
					</code></pre>
				<td>
					<img src="images/shadow-inner-spread-round.png" width="175" height="175"
					     alt="A round-cornered box with a light gray shadow the inverse shape
					          of the box but 20px narrower and shorter filling 20px in from
					          the top and left edges (just inside the border)."
					>
				<td>
					<img src="images/shadow-inner-spread-square.png" width="175" height="175"
					     alt="A round-cornered box with a light gray shadow the inverse shape
					          of the box but 20px narrower and shorter filling 20px in from
					          the top and left edges (just inside the border)."
					>
		</table>
	</div>

	To preserve the box's shape when spread is applied,
	the corner radii of the shadow are also increased (decreased, for inner shadows)
	from the border-box (padding-box) radii by adding (subtracting)
	the [=spread distance=] (and flooring at zero).
	For outer shadows, the [=border radius=] is then [=outset-adjusted border radius|adjusted=], independently in each dimension,
	to preserve the sharpness of rounded corners.

	The 'border-image' does not affect the shape of the box-shadow.

	<wpt>
		box-shadow-radius-generated.html
	</wpt>

<h4 id="shadow-blur">
Blurring Shadow Edges</h4>

	A non-zero [=blur radius=] indicates
	that the resulting shadow should be blurred,
	such as by a Gaussian filter.
	The exact algorithm is not defined;
	however the resulting shadow must approximate
	(with each pixel being within 5% of its expected value)
	the image that would be generated by applying to the shadow
	a Gaussian blur with a standard deviation equal to half the blur radius.

	Note: This means for a long, straight shadow edge,
	the blur radius will create a visibly apparent color transition
	approximately the twice length of the blur radius
	that is perpendicular to and centered on the shadow's edge,
	and that ranges
	from almost the full shadow color at the endpoint inside the shadow
	to almost fully transparent at the endpoint outside it.

<h4 id="shadow-layers">
Layering, Layout, and Other Details</h4>

	The shadow effects are applied front-to-back:
	the first shadow is on top and the others are layered behind.
	Shadows do not influence layout and may overlap (or be overlapped by)
	other boxes and text or their shadows.
	In terms of stacking contexts and the painting order,
	the [=outer box-shadows=] of an element are drawn immediately below the background of that element,
	and the [=inner shadows=] of an element are drawn immediately above the background of that element
	(below the borders and border image, if any).

	Unless otherwise specified, drop shadows are only applied to the [=principal box=].
	If the affected box has multiple fragments,
	the shadows are applied as specified in 'box-decoration-break'.

	Shadows are [=ink overflow=];
	they do not trigger scrolling or increase the size of the [=scrollable overflow area=].

	Outer shadows have no effect on internal table elements in the collapsing border model.
	If a shadow is defined for single border edge in the collapsing border model
	that has multiple border thicknesses
	(e.g. an outer shadow on a table where one row has thicker borders than the others,
	or an inner shadow on a rowspanning table cell that adjoins cells with different border thicknesses),
	the exact position and rendering of its shadows are undefined

<h2 id="levels">
Levels</h2>

	<em>This section is informative.</em>
	CSS has different levels of features, each a subset of the other.
	(See [[CSS-2017]] for a full explanation.)
	The lists below describe which features from this specification are in each level.

<h3 id="level-1">
Level 1</h3>

	<ul>
		<li>'background-color'
		<li>'background-image' only one image (no layers)
		<li>'background-repeat': only ''background-repeat/repeat'' | ''repeat-x'' | ''repeat-y'' | ''no-repeat''
		<li>'background-attachment': only ''scroll'' | ''fixed''
		<li>'background-position': only one or two values allowed
		<li>'background' shorthand: only color, image, repeat, attachment and position
		<li>'border-color' properties
		<li>'border-style' properties
		<li>'border-width' properties
		<li>'border-top', 'border-bottom', 'border-right', 'border-left', and 'border' shorthands
	</ul>

<h3 id="level-2">
Level 2</h3>

	<ul>
		<li>'background-color'
		<li>'background-image': only one image (no layers)
		<li>'background-repeat': only ''background-repeat/repeat'' | ''repeat-x'' | ''repeat-y'' | ''no-repeat''
		<li>'background-attachment': only ''scroll'' | ''fixed''
		<li>'background-position': only one or two values allowed
		<li>'background': only color, image, repeat, attachment and position
		<li>'border-color' properties
		<li>'border-style' properties
		<li>'border-width' properties
		<li>'border-top', 'border-bottom', 'border-right', 'border-left', and 'border' shorthands
	</ul>

<h3 id="level-3">
Level 3</h3>

	<ul>
		<li>All features described in the CSS Backgrounds and Borders Module Level 3
	</ul>


<h2 id="changes">
Changes</h2>

<h3 id="changes-2024-03">
Changes since the 11 March 2024 Candidate Recommendation Draft</h3>

	<ul>
		<li>Changed the special case of 'border-width' having a value of ''0'' when 'border-style' is ''border-style/none'' or ''border-style/hidden''
			from a computed-value effect to a resolved-value effect.
			(<a href="https://github.com/w3c/csswg-drafts/issues/11494">Issue 11494</a>)

		<!-- to 5 Nov 2025 -->
		<li>Altered the border-radius outset adjustment,
			so the radius reduction factor in the
			minimum radius percentage of the corner, makes it less pronounced
			the closer the corner's border-radius gets to 50%.
			(<a href="https://github.com/w3c/csswg-drafts/issues/7103">Issue 7103</a>)
		</li>
		<li>Fixed syntax of 'box-shadow' to avoid allowing negative blur radii,
			aligning it with the prose.
		<li>Cross linked to 'ink overflow' terminology</li>
	</ul>

<h3 id="changes-2023-02">
Changes since the 14 February 2023 Candidate Recommendation Snapshot</h3>

	<ul>
		<li>Defined serialization of 'background-position' in [[#bg-position-serialization]].
			(<a href="https://github.com/w3c/csswg-drafts/issues/2274">Issue 2274</a>)
		<li>Reverted <a href="#bg-color-move">change moving &lt;color> to the front of &lt;final-bg-layer></a>
			in the 'background' shorthand.
			(<a href="https://github.com/w3c/csswg-drafts/issues/8496">Issue 8496</a>)
		<li>Specified [=snapped as a border width|rounding of border widths=] to device pixels.
			(<a href="https://github.com/w3c/csswg-drafts/issues/7434">Issue 7434</a>)
		<li>Specified interaction of 'border-radius' and per-axis 'overflow' longhands.
			(<a href="https://github.com/w3c/csswg-drafts/issues/5210">Issue 5210</a>)
		<li>Fixed an error in the Computed Value line of 'background-image'.
			(<a href="https://github.com/w3c/csswg-drafts/issues/8604">Issue 8604</a>)
		<li>Removed the &lt;box> definition
			(replacing it with a <<visual-box>> reference),
			as the Box Module now defines these terms.
		<li>Aligned property definition tables with the latest expectations
			to include “Animation Type” and “Logical Property Group”.
		<li>Streamlined property grammar definitions using the latest
			[=CSS/value definition syntax=].
		<li>Fixed the definition for where box shadows apply.
			(<a href="https://github.com/w3c/csswg-drafts/issues/9286">Issue 9286</a>)
		<li>Defined serialization of 'background-size' in [[#bg-size-serialization]].
			(<a href="https://github.com/w3c/csswg-drafts/issues/7802">Issue 7802</a>)
	</ul>


<h3 id="changes-2020-12">
Changes since the 22 December 2020 Candidate Recommendation Snapshot</h3>

	<ul>
		<li>Clarified that the rule about not propagating backgrounds from the root
			when it doesn't generate boxes only applies to ''display: none'',
			not ''display: contents''.
			(<a href="https://github.com/w3c/csswg-drafts/issues/3779">Issue 3779</a>)
		<li>Precisely defined the size of 'border-width' ''thin'', ''medium'', and ''thick''.
			(<a href="https://github.com/w3c/csswg-drafts/issues/7254">Issue 7254</a>)
		<li>Minor editorial improvements.
	</ul>

<h3 id="changes-2017-10">
Changes since the 17 October 2017 Candidate Recommendation</h3>

	<ul>
		<li>
			Inverted order of <<shadow>> grammar to match browser serialization and 'text-shadow'/''drop-shadow()''.
				(<a href="https://github.com/w3c/csswg-drafts/issues/2305">Issue 2305</a>)
				<blockquote>
					<pre><<shadow>> = <del>inset</del><ins><<color>></ins>? &amp;&amp; <<length>>{2,4} &amp;&amp; <del><<color>></del><ins>inset</ins>?</pre>
				</blockquote>
		<li>
			Spread radius adjustment is only applied to shadows and margins
			where the radius of curvature grows, rather than shrinks.
			(<a href="https://github.com/w3c/csswg-drafts/issues/1900">Issue 1900</a>)
				<blockquote>
					To preserve the box's shape when spread is applied,
					the corner radii of the shadow are also increased (decreased, for inner shadows)
					from the border-box radii by adding (subtracting)
					the [=spread distance=] (and flooring at zero).
					However, in order to create a sharper corner when the border radius is small
					<ins>(and thus ensure continuity between round and sharp corners)</ins>,
					when the [=border radius=] is less than the [=spread distance=]
					<ins>(or in the case of an inner shadow,
					less than the absolute value of a negative [=spread distance=])</ins>,
					the [=spread distance=]
					is multiplied by the proportion 1 + (<var>r</var>-1)<sup>3</sup>,
					where <var>r</var> is the ratio of the border radius to the [=spread distance=],
					in calculating the corner radii of the spread shadow shape.
				</blockquote>
		<li>
			Clarified that an omitted <<color>> in a <<shadow>> defaults to ''currentColor'',
			not some mysterious unnamed value with the same behavior.
			(<a href="https://github.com/w3c/csswg-drafts/issues/2766">2766</a>)
			<blockquote>
				If the color is absent, <ins>it defaults to ''currentColor''</ins>
				<del>the used color is taken from the 'color' property.</del>
			</blockquote>
		<li>
			Cleaned up and regularized “Animation type” and “Computed value” lines
			in the property definition tables.
		<li>
			Changed syntax to use the new <a>CSS bracketed range notation</a>
			to reflect the prose restrictions on negative values,
			and corrected a few grammar definition errors introduced in the previous publication.
		<li>
			Minor editorial improvements.
	</ul>

<h3 id="changes-2014-09">
Changes since the 9 September 2014 Candidate Recommendation</h3>

	The following (non-trivial) changes were made to this specification since the
	<a href="https://www.w3.org/TR/2014/CR-css3-background-20140909/">9 September 2014 Candidate Recommendation</a>:
	<ul>
		<li>Added missing definition of ''box-shadow: none''.
		(Apparently this was obvious enough that nobody noticed it was missing until now.)
		<li id="bg-color-move">Moved <<'background-color'>> component of <<final-bg-layer>> to the front for serialization
		because some authors seem to expect this even though it makes less sense?
		<li>Dropped effect of 'border-radius' from collapsed-borders tables.
		<li>Renamed <<position>> back to <<bg-position>>
				since other properties will be eliding the three-value syntax.
	</ul>

<h3 id="changes-2014-02">
Changes since the 4 February 2014 Last Call Working Draft</h3>

	The following (non-trivial) changes were made to this specification since the
	<a href="https://www.w3.org/TR/2014/WD-css3-background-20140204/">4 February 2014 Last Call Working Draft</a>:
	<ul>
		<li>Fixed spread radius and margin radius calculations
		to only apply adjustment factor when spread/margin is larger than border radius.
		<li>Defined handling of canvas background when root element has ''display: none''.
	</ul>

	A full <a href="https://drafts.csswg.org/css-backgrounds-3/issues-lc-2014">Disposition of Comments</a> is available.

<h3 id="changes-2012-07">
Changes since the 24 July 2012 Candidate Recommendation</h3>

	The following (non-trivial) changes were made to this specification since the
	<a href="https://www.w3.org/TR/2012/CR-css3-background-20120724/">24 July 2012 Candidate Recommendation</a>:

	<ul>
		<li>Allow <<'background-clip'>> and <<'background-origin'>>
			to be separated by other component values in the 'background' shorthand,
			since this is what is implemented.
		<li>Allow <<color>> and ''box-shadow/inset'' to be interleaved in any order in 'box-shadow',
			since they are not ambiguous and CSS generally allows variant ordering where not ambiguous.
		<li>Define gradually increasing corner radius formula for 'box-shadow' spread curvature
			to create continuity between sharp corners ('border-radius' = 0)
			and curved corners ('border-radius' > <var>spread distance</var>).
			This also gives better results for all intermediate states.
		<li>Add definition for how the margin edge is curved in response to border-radius.
			(This is relevant for [[CSS-SHAPES]], but does not change conformance to CSS Backgrounds and Borders Level 3.)
		<li>Removed 'box-decoration-break'; it is now part of [[CSS-BREAK-3]].
		<li>Tighten up the definition of spread for 'box-shadow'.
		<li>Clarify that a 'border-style' of ''border-style/none'' also implies an initial 'border-image-width' of zero
			(since 'border-image-width' is initially set to the computed 'border-width', which in this case is zero).
		<li>Clarified how ''background-attachment: local'' is affected by scrolling.
		<li>Simplified computed value of 'background-position'
			to clarify that all 'background-position' values are interpolable.
		<li>Added “Animation Type” values to each property definition table.
	</ul>

<h3 id="changes-2012-04">
Changes since the 17 April 2012 Candidate Recommendation</h3>

	The following (non-editorial) changes were made to this specification since the
	<a href="https://www.w3.org/TR/2012/CR-css3-background-20120417/">17
	April 2012 Candidate Recommendation</a>:

	<ul>
		<li>Fix error in computed value of 'background-position':
			the computed value is a list of positions.
		<li>Add a note pointing out that when 'border-radius' reduces
			the interactive area, the width/height of the box might need to be increased.
	</ul>

<h3 id="changes-2012LC">
Changes since the 14 February 2012 “Last Call” Working Draft</h3>

	The following (non-editorial) changes were made to this
	specification since the <a href="https://www.w3.org/TR/2012/WD-css3-background-20120214/">14 February 2012 “Last Call” Working Draft</a>:

	These changes were in response to comments received during the
	review period. For details, see the full <a href="https://drafts.csswg.org/css-backgrounds-3/issues-lc-2012">Disposition of Comments.</a>

	<ul>
		<li><a href="#placement">Section 2.1</a>: Defined which properties
		from this module apply to the ''::first-line'' and
		''::first-letter'' pseudo-elements.

		<li><a href="#background-repeat">Section 3.4</a>: Fixed the
		incorrect definition of the computed value of
		'background-repeat'. The value is always a pair of keywords, never a
		single keyword.

		<li><a href="#background-image">Section 3.10</a>: Added the missing
		'background-image' to the list of properties that the 'background'
		property reset.

		<li><a href="#border-width">Section 4.3</a>: Added that negative
		lengths are invalid on 'border-width'.

		<li><a href="#border-radius">Section 5.1</a>: Added that
		negative lengths are invalid on 'border-radius'.

		<li><a href="#border-image-tables">Section 6.8</a>: Added a section
		about the effect of 'border-image' on tables with collapsed borders
		and added that the rendering will be defined later.
	</ul>

<h3 id="changes-2011">
Changes Since the 15 February 2011 Candidate Recommendation</h3>

	The following changes were made to this specification since the
	<a href="https://www.w3.org/TR/2011/CR-css3-background-20110215/">15 February 2011
	Candidate Recommendation</a>:

	<ul>
		<li><a href="#background-size">Section 3.9</a>:
			Defined what happens if 'background-size' has two ''background-size/auto'' values
			and the image is missing a natural size.
			<blockquote>
			If both values are ''background-size/auto'' then the natural width and/or
			height of the image should be used, if any<ins>, the missing
			dimension (if any) behaving as ‘auto’ as described above</ins>.
			</blockquote>
		<li><a href="#corner-transitions">Section 5.4</a>:
			Made center of <a href="#corner-transitions">color and style transitions</a>
			undefined (within certain limits) on corner joins, since previous definition
			was wrong.
			<blockquote>
			<del>The center of color and style transitions between
			adjoining borders is at the point on the curve that is at an angle
			that is proportional to the ratio of the border widths. For
			example, if the top and right border widths are equal, that point
			is at a 45° angle from the horizontal, and if the top is twice the
			width of the right the point is at a 30° angle from the
			horizontal. The line demarcating this transition is drawn between
			the point at that angle on the outer arc and the point at that
			angle on the inner arc.</del>
			<ins>If one of these borders is zero-width, then the other
			border takes up the entire transitional area. Otherwise, the
			center of color and style transitions between adjoining borders
			must be proportional to the ratio of the border widths such that a
			function of its location is continuous with respect to this ratio.
			However it is not defined what these transitions look like or how
			&ldquo;proportional&rdquo; maps to a point on the curve.</ins>
			</blockquote>
		<li><a href="#border-image-slice">Section 6.2</a>:
			Defined <a href="#border-image-slice">slicing of border images</a>
			that must be sized first to determine slice positions.
			Added:
			<blockquote>
			<ins>If the image must be sized to determine the slices (for
			example, for SVG images with no natural size), then it is sized
			as for an auto-sized background, using the border image area as
			the default object size in place of the background positioning
			area.</ins>
			</blockquote>
		<li><a href="#misc">Section 7.1</a>
			Optionally added bidi-imposed breaks to the types of breaks affected by
				'box-decoration-break'.
			Added:
			<blockquote>
			<ins>UAs may also apply ‘box-decoration-break’ to control
			rendering at bidi-imposed breaks, i.e. when bidi reordering causes
			an inline to split into non-contiguous fragments. Otherwise such
			breaks are always handled as ‘slice’.</ins>
			</blockquote>
		<li><a href="#box-shadow">Section 7.2</a>:
			Defined the default color of 'box-shadow'.
			<blockquote>
			The color is the color of the shadow. <ins>If the color is
			absent, the used color is taken from the ‘color’ property.</ins>
			</blockquote>
		<li><a href="#background-position">Section 3.6</a>:
			Clarified computed value of 'background-position'.
			<blockquote>
			<del>If one or two values are specified, for a &lt;length> the
			absolute length, otherwise a percentage. If three or four values
			are specified, two pairs of a keyword plus a length or
			percentage.</del> <ins>Two keywords representing the origin and
			two offsets from that origin, each given as an absolute length (if
			given a <<length>>), otherwise as a percentage.</ins>
			</blockquote>
			Changed <del>Equivalent</del> to <ins>Computes</ins> in
			definition of keywords.
		<li>Added "Animation Type" line to property definition tables.
		<li><a href="#background-position">Section 3.6</a>:
			Renamed &lt;bg-position&gt; production to <<position>> for
			easier re-use in other specifications and recast the grammar to be more
			verbose but easier to understand.
			<blockquote>
			<pre class=prod>
				<del>bg-position</del><ins>&lt;position&gt;</ins> = [
					[ <ins>left | center | right |</ins> top | bottom <ins>| <<length-percentage>></ins> ]
				|
					[ left | center | right | <<length-percentage>> ]
					[ top | center | bottom | <<length-percentage>> ]<del>?</del>
				|
					[ center | [ left | right ] <<length-percentage>>? ] &amp;&amp;
					[ center | [ top | bottom ] <<length-percentage>>? ]
				]
			</pre>
			</blockquote>
		<li><a href="#border-image-repeat">Section 6.5</a>:
			Added ''border-image-repeat/space'' keyword to 'border-image-repeat' property value table:
			it was included in the list of allowable values, but not in the syntax
			definition.
			<blockquote>
			[ stretch | repeat | round <ins>| space</ins> ]{1,2}
			</blockquote>
		<li><a href="#corner-overlap">Section 5.5</a>:
			Corrected math error in border-radius example.
			<blockquote>
			The height (2.5em) is enough for the specified radii (0.5em
			plus <del>2.5em</del> <ins>2.0em</ins>).
			</blockquote>
		<li><a href="#border-width">Section 4.3</a>:
			Marked Percentages field as N/A for 'border-width', since they are not
			included in the property.
	</ul>

<h3 id="changes-2009">
Changes Since the 17 December 2009 Candidate Recommendation</h3>

	The following changes were made to this specification since the
	<a href="https://www.w3.org/TR/2009/CR-css3-background-20091217/">17 December 2009
	Candidate Recommendation</a>:

	<ul>
		<li>Addition of ''background-clip/content-box'' value of 'background-clip'.
		<li>Change to the 'background' shorthand syntax for 'background-clip'
				and 'background-origin'.
		<li>Removal of recommendation to use gradients for color transitions
				when 'border-radius' produces a curve.
		<li>(Re)Addition of ''box-shadow'' property.
		<li>Various clarifications.
	</ul>

<h2 id="acknowledgments">Acknowledgments</h2>

	Tapas Roy was editor of the Border Module,
	before it was merged with the Background Module.

	Thanks to Ben Stucki for defining what happens with rounded corners
	if the two adjoining borders are of unequal thickness or one of them is zero;
	to Arjan Eising and Anne van Kesteren for the 'border-radius' syntax;
	to Zack Weinberg for the corner transition regions diagram;
	and to Lea Verou, plinss, and dbaron for the corner radius adjustment formula
	(with special thanks to Lea for the live demo).

	A set of properties for border images was initially proposed by <i>fantasai</i>.
	The current simplification (one image cut into nine parts) is due to Ian Hickson.
	(Though the original idea seems to originate with some anonymous Microsoft engineers.)

	Finally, special thanks go to Brad Kemper for his feedback and suggestions
	for many of the features in the draft,
	for drawing all the box-shadow examples,
	and for proposing some
	<a href="http://www.bradclicks.com/cssplay/border-image/Thinking_Outside_The_Box.html">radical changes</a>
	to the 'border-image' property
	that solved a number of problems with the earlier definition.

<h2 id=privacy>Privacy Considerations</h2>

	This specification introduces no new privacy considerations.

<h2 id=security>Security Considerations</h2>

	This specification introduces no new security considerations.

<wpt hidden title="Tests related to later levels of this specification">
	animations/background-position-x-interpolation.html
	animations/background-position-y-interpolation.html
	background-position-xy-three-four-values-passthru.html
	parsing/background-position-x-computed.html
	parsing/background-position-x-invalid.html
	parsing/background-position-x-valid.html
	parsing/background-position-y-computed.html
	parsing/background-position-y-invalid.html
	parsing/background-position-y-valid.html
</wpt>

<wpt hidden title="visual tests">
	background-color-applied-to-rounded-inline-element.htm
	background-color-border-box.htm
	background_color_padding_box.htm
	background-repeat-round-001.html
	background-repeat-round-002.html
	background-repeat-space-padding-box.htm
	background_repeat_space_border_box.htm
	background_repeat_space_content_box.htm
	background-attachment-fixed.html
	background-attachment-local-inline-002.html
	background-attachment-local-scrolling.htm
	background-attachment-local.html
	background-clip-root.html
	background-clip/clip-border-box.html
	background-clip/clip-border-box_with_position.html
	background-clip/clip-border-box_with_radius.html
	background-clip/clip-border-box_with_size.html
	background-clip/clip-content-box.html
	background-clip/clip-content-box_with_position.html
	background-clip/clip-content-box_with_radius.html
	background-clip/clip-content-box_with_size.html
	background-clip/clip-padding-box.html
	background-clip/clip-padding-box_with_position.html
	background-clip/clip-padding-box_with_radius.html
	background-clip/clip-padding-box_with_size.html
	background-clip-content-box.html
	background-size-003.html
	background-size-022.html
	background-size-023.html
	background-size-024.html
	background-size-032.html
	background-size-033.html
	background-size-applies-to-block.htm
	background-size-aspect-ratio.htm
	border-color_transparent.html
	ttwf-css3background-border-color-shorthand-missing-bottom.htm
	ttwf-css3background-border-color-shorthand-missing-left.htm
	ttwf-css3background-border-color-shorthand-missing-right.htm
	ttwf-css3background-border-color-shorthand.htm
	ttwf-css3background-border-color.htm
	ttwf-css3background-border-style-double.htm
	ttwf-css3background-border-style-shorthand-missing-bottom.htm
	ttwf-css3background-border-style-shorthand-missing-left.htm
	ttwf-css3background-border-style-shorthand.htm
	ttwf-css3background-border-style-values.htm
	ttwf-css3background-border-style.htm
	border-bottom-left-radius-002.xht
	border-bottom-left-radius-012.xht
	border-bottom-left-radius-013.xht
	border-bottom-right-radius-002.xht
	border-bottom-right-radius-012.xht
	border-bottom-right-radius-013.xht
	border-radius-applies-to-001.htm
	border-radius-applies-to-002.htm
	border-radius-applies-to-003.htm
	border-radius-applies-to-004.htm
	border-radius-applies-to-005.htm
	border-radius-applies-to-006.htm
	border-radius-applies-to-007.htm
	border-radius-applies-to-008.htm
	border-radius-applies-to-009.htm
	border-radius-applies-to-010.htm
	border-radius-applies-to-011.htm
	border-radius-applies-to-012.htm
	border-radius-applies-to-013.htm
	border-radius-applies-to-014.htm
	border-radius-applies-to-015.htm
	border-radius-applies-to-016.htm
	border-radius-applies-to-017.htm
	border-radius-content-edge-001.htm
	border-radius-different-width-001.htm
	border-radius-initial-value-001.htm
	border-radius-not-inherited-001.htm
	border-radius-overflow-hidden.html
	border-radius-shorthand-001.htm
	border-radius-style-001.htm
	border-radius-style-002.htm
	border-radius-style-003.htm
	border-radius-style-004.htm
	border-radius-style-005.htm
	border-radius-sum-of-radii-001.htm
	border-radius-sum-of-radii-002.htm
	border-radius-with-three-values-001.htm
	border-radius-with-two-values-001.htm
	border-top-left-radius-002.xht
	border-top-left-radius-012.xht
	border-top-left-radius-013.xht
	border-top-left-radius-values-001.htm
	border-top-left-radius-values-002.htm
	border-top-left-radius-values-003.htm
	border-top-left-radius-values-004.htm
	border-top-right-radius-002.xht
	border-top-right-radius-012.xht
	border-top-right-radius-013.xht
	border-top-right-radius-values-004.htm
	border-image-outset-001.htm
	border-image-outset-002.htm
	border-images.html
	box-shadow-001.htm
	box-shadow-002.htm
	box-shadow-003.htm
	box-shadow-004.htm
	box-shadow/box-shadow-blur-definition-001.xht
	background_properties_greater_than_images.htm
	none-as-image-layer.htm
</wpt>

<wpt hidden title="crashes">
	background-repeat/background-repeat-image-larger-than-positioning-area-crash.html
	gradient-wrong-interpolation-crash.html
	linear-gradient-calc-crash.html
	tiny-foreignObject-double-border-radius-crash.html
</wpt>

<wpt hidden title="not actually testing css-backgrounds-3, why are they here">
	background-gradient-interpolation-001.html
	background-gradient-interpolation-002.html
	background-gradient-interpolation-003.html
	color-mix-currentcolor-outline-repaint-parent.html
	color-mix-currentcolor-outline-repaint.html
	first-letter-space-not-selected.html
	animations/background-color-animation-custom-property.html
	animations/background-color-animation-custom-timing-function-reverse.html
	animations/background-color-animation-custom-timing-function.html
</wpt>
