Group: CSSWG Shortname: css-values Level: 3 Status: ED Work Status: Testing ED: https://drafts.csswg.org/css-values/ TR: https://www.w3.org/TR/css-values/ Previous Version: https://www.w3.org/TR/2015/CR-css-values-3-20150611/ Previous Version: https://www.w3.org/TR/2013/CR-css3-values-20130730/ Previous Version: https://www.w3.org/TR/2013/CR-css3-values-20130404/ Previous Version: https://www.w3.org/TR/2012/CR-css3-values-20120828/ Previous Version: https://www.w3.org/TR/2012/WD-css3-values-20120308/ Previous Version: https://www.w3.org/TR/2011/WD-css3-values-20110906/ Previous Version: https://www.w3.org/TR/2006/WD-css3-values-20060919 Previous Version: https://www.w3.org/TR/2005/WD-css3-values-20050726 Previous Version: https://www.w3.org/TR/2001/WD-css3-values-20010713/ Editor: Tab Atkins, Google, http://xanthir.com/contact/ Editor: fantasai, http://fantasai.inkedblade.net/contact, w3cid 35400 Former Editor: Håkon Wium Lie, Opera Software, howcome@opera.com Abstract: This CSS module describes the common values and units that CSS properties accept and the syntax used for describing them in CSS property definitions. At Risk: ''attr()'' Ignored Terms:, containing block Ignored Vars: Cn+1, n Inline Github Issues: yes
spec: css-backgrounds-3; type: type; text:spec: css21; type: property; text: border-collapse spec: css-color-4; type: value; text: currentcolor spec: css-cascade-4; type: at-rule; text: @import
auto)
example( first? , second? , third? )Given this grammar, writing ''example(first, second, third)'' is valid, as is ''example(first, second)'' or ''example(first, third)'' or ''example(second)''. However, ''example(first, , third)'' is invalid, as one of those commas are no longer separating two options; similarly, ''example(,second)'' and ''example(first,)'' are invalid. ''example(first second)'' is also invalid, as commas are still required to actually separate the options. If commas were not implicitly omittable, the grammar would have to be much more complicated to properly express the ways that the arguments can be omitted, greatly obscuring the simplicity of the feature.
<color>{1,4} | inherit | initial | unset
(even though it is listed as <color>{1,4}).
Note: This implies that, in general,
combining these keywords with other component values in the same declaration
results in an invalid declaration.
For example,
''background: url(corner.png) no-repeat, inherit;'' is invalid.
a b | c || d && e f [ a b ] | [ c || [ d && [ e f ]]]For reorderable combinators (||, &&), ordering of the grammar does not matter: components in the same grouping may be interleaved in any order. Thus, the following lines are equivalent:
a || b || c b || a || c
| in order | any order | |
|---|---|---|
| zero or more | A? B? C? | A? || B? || C? |
| one or more | [ A? B? C? ]! | A || B || C |
| all | A B C | A && B && C |
| Property | Value definition field | Example value |
|---|---|---|
| 'orphans' | <integer> | ''3'' |
| 'text-align' | left | right | center | justify | ''text-align/center'' |
| 'padding-top' | <length> | <percentage> | ''5%'' |
| 'outline-color' | <color> | invert | ''#fefefe'' |
| 'text-decoration' | none | underline || overline || line-through || blink | ''overline underline'' |
| font-family | [ <family-name> | <generic-family> ]# | ''"Gill Sans", Futura, sans-serif'' |
| 'border-width' | [ <length> | thick | medium | thin ]{1,4} | ''2px medium 4px'' |
| 'text-shadow' | [ inset? && [ <length>{2,4} && <color>? ] ]# | none | ''3px 3px rgba(50%, 50%, 50%, 50%), lemonchiffon 0 0 4px inset'' |
Value: collapse | separateAnd here is an example of its use:
table { border-collapse: separate }
"\"" or as "\22").
Analogously for single quotes ('\'' or '\27').
content: "this is a 'string'."; content: "this is a \"string\"."; content: 'this is a "string".'; content: 'this is a \'string\'.'
a[title="a not s\
o very long title"] {/*...*/}
a[title="a not so very long title"] {/*...*/}
<url> = url( <> < >* )
body { background: url("http://www.example.com/pinkish.gif") }
background: url("http://www.example.com/pinkish.gif");
background: url(http://www.example.com/pinkish.gif);
@import url("base-theme.css");
@import "base-theme.css";
body { background: url("tile.png") }
is located in a style sheet designated by the URL:
http://www.example.org/style/basic.cssThe background of the source document's
<body>
will be tiled with whatever image is described by the resource designated by the URL:
http://www.example.org/style/tile.pngThe same image will be used regardless of the URL of the source document containing the
<body>.
#) character,
parse it as per normal for URLs,
but additionally set the local url flag of the ''url()''.
When matching a ''url()'' with the local url flag set,
ignore everything but the URL's fragment,
and resolve that fragment against the current document that relative URLs are resolved against.
This reference must always be treated as same-document
(rather than cross-document).
When serializing
a ''url()'' with the local url flag set,
it must serialize as just the fragment.
[ <> | <> ] ,
where the <[ <> | <> ] ,
where the <[ <> | <> ] ,
where the <[ <,
where the <