Title: CSS Backgrounds Module Level 4 Shortname: css-backgrounds Level: 4 Status: ED Work Status: Exploring Group: csswg ED: https://drafts.csswg.org/css-backgrounds-4/ Editor: Bert Bos, W3C, bert@w3.org, w3cid 3343 Editor: Elika J. Etemad / fantasai, Apple, http://fantasai.inkedblade.net/contact, w3cid 35400 Editor: Lea Verou, Invited Expert, http://lea.verou.me/about/, w3cid 52258 Editor: Sebastian Zartner, Invited Expert, sebastianzartner@gmail.com, w3cid 64937 Abstract: This module contains the features of CSS relating to the backgrounds of boxes on the page. Ignored Terms: total width Warning: Not Ready
spec:css-text-4; type:value; text:collapse spec:css-shapes-2; type:function; text:path() spec:css-borders-4; type:property; text:border-color
This module is currently maintained as a diff against the parts related to backgrounds of CSS Backgrounds and Borders Module Level 3 [[CSS3BG]]. We will fold in the text once it's all formatted up and in CR again, as this will reduce the effort of keeping them in sync (source diffs will be accurate in reflecting the differences).
Name: background-repeat-x, background-repeat-y, background-repeat-block, background-repeat-inline Value: <># Initial: repeat Inherited: no Percentages: N/A Computed value: as specified Animation type: discrete Logical property group: background-repeat
<> = repeat | space | round | no-repeat
These properties specify whether and how background images are tiled along one axis after they have been sized and positioned.
Unless one of the axes is set to ''no-repeat'', the whole background painting area will be tiled, i.e., not just one vertical strip and one horizontal strip.
body {
background: white url("pendant.png");
background-repeat-y: repeat;
background-position: center;
}
The effect of ''repeat'': 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.
See the section “Layering multiple background images” for how 'background-repeat-x', 'background-repeat-y', 'background-repeat-block', and 'background-repeat-inline' interact with other comma-separated background properties to form each background image layer.
Name: background-repeat Value: <># 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
This shorthand sets the values for the 'background-repeat-x' and 'background-repeat-y' longhand properties. Where
<> = repeat-x | repeat-y | <>{1,2}
Single values for < If a < The effect of ''background-repeat/space'': the image of a dot is
tiled to cover the whole background and the images are equally
spaced.
See the section “Layering multiple background
images” for how 'background-repeat' interacts with other
comma-separated background properties to form each background image
layer.
Issue: Should a 'background-repeat: extend' be added?
The 'background-tbd' property is a [=shorthand property=]
that sets all the same properties as the 'background' shorthand
except for 'background-color',
allowing authors to easily declare and position background images
while letting 'background-color' cascade through independently.
Issue:
The name of this property is discussed in
issue 9083.
In addition to the many contributors to the [[CSS1]], [[CSS21]],
and [[CSS3BG]] predecessors to this module,
the editors would like to thank
Tab Atkins,
and Håkon Wium Lie
for their suggestions and feedback specifically for this Level 4.
body {
background-image: url(dot.png) white;
background-repeat: space
}
Background Positioning: the 'background-position' shorthand property
Name: background-position
Value: <
If [=background images=] have been specified,
this property specifies their initial position
(after any resizing)
within their corresponding [=background positioning area=].
This property is a [=shorthand property=] that sets
'background-position-x', 'background-position-y', 'background-position-block', and 'background-position-inine'
in a single declaration.
Its value is given as a comma-separated list
of <
<
The omitted <
Background Positioning Longhands: the 'background-position-x', 'background-position-y', 'background-position-inline', and 'background-position-block' properties
Issue: This section is still being worked out. The tricky thing is making all the start/end keywords work sanely.
Name: background-position-x
Value: [ center | [ [ left | right | x-start | x-end ]? <
This property specifies the background position's horizontal component.
An omitted origin keyword is assumed to be ''background-position-x/left''.
Name: background-position-y
Value: [ center | [ [ top | bottom | y-start | y-end ]? <
This property specifies the background position's vertical component.
An omitted origin keyword is assumed to be ''background-position-y/top''.
Name: background-position-inline
Value: [ center | [ [ start | end ]? <
This property specifies the background position's inline-axis component.
An omitted origin keyword is assumed to be ''background-position-inline/start''.
Name: background-position-block
Value: [ center | [ [ start | end ]? <
This property specifies the background position's block-axis component.
An omitted origin keyword is assumed to be ''background-position-block/start''.
Painting Area: the 'background-clip' property
Name: background-clip
Value: <
Determines the background painting area,
which determines the area within which the background is painted.
The syntax of the property is given with
<bg-clip> = <
Issue: Or should this be defining the
Background Image Layers: the 'background-tbd' shorthand property
Name: background-tbd
Value: <
p {
background-color: green;
}
p {
background-tbd:
url(a.png) top left,
url(b.png) top left no-repeat;
}
p {
background: url(pass.png) green; /* valid */
background-tbd: url(fail.png) red; /* invalid */
}
Changes
Additions since [[CSS3BG]]
* turned 'background-position' into a shorthand and added physical and logical longhands
* added logical keywords to <
Acknowledgments
Privacy Considerations
No new privacy considerations have been reported on this specification.
Security Considerations
No new security considerations have been reported on this specification.