CARVIEW |
CSS Basic User Interface Module Level 4
W3C First Public Working Draft,
- This version:
- https://www.w3.org/TR/2015/WD-css-ui-4-20150922/
- Latest version:
- https://www.w3.org/TR/css-ui-4/
- Editor's Draft:
- https://dev.w3.org/csswg/css-ui-4/
- Feedback:
- www-style@w3.org with subject line “[css-ui] … message topic …” (archives)
- Issue Tracking:
- GitHub
- https://wiki.csswg.org/spec/css4-ui#css4-ui-issues-list
- Editor:
- Florian Rivoal (Invited Expert) florian@rivoal.net
Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and document use rules apply.
Abstract
This specification describes user interface related properties and values to style HTML and XML (including XHTML). It includes and extends user interface related features from the properties and values of previous CSS levels. It uses various properties and values to style basic user interface elements in a document.
CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, in speech, etc.Status of this document
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.
This document is a First Public Working Draft.
Publication as a First Public Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
The (archived) public mailing list www-style@w3.org (see instructions) is preferred for discussion of this specification. When sending e-mail, please put the text “css-ui” in the subject, preferably like this: “[css-ui] …summary of comment…”
This document was produced by the CSS Working Group (part of the Style Activity).
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is governed by the 1 September 2015 W3C Process Document.
This specification will include and extend CSS Basic User Interface Module Level 3. [CSS3-UI]
Table of Contents
- 1 Introduction
- 2 Module Interactions
- 3 Box Model addition
- 4 Outline properties
- 5 Resizing & Overflow
- 6 Pointing Devices and Keyboards
- 7 User Interaction
- 8 Form Control Styling
- Appendix A. Acknowledgments
- Appendix B. Changes
- Appendix C. Considerations for Security and Privacy
- Appendix D. Default style sheet additions for HTML
- Conformance
- Index
- References
- Property Index
- Issues Index
1. Introduction
This module describes CSS properties which enable authors to style user interface related properties and values.
Section 2.1 of CSS1 [CSS1] and Chapter 18 of CSS2 [CSS2] introduced several user interface related properties and values. User Interface for CSS3 (16 February 2000) introduced several new user interface related features.
[CSS3-UI] was later introduced to incorporates, extends, and supersedes these. This specification continues this work, and in turn replaces [CSS3-UI].
Note: At the time of writing, [CSS3-UI] is not completely finalized yet. To avoid accidental divergences and maintenance overhead, This specification is written as a delta specification over CSS-UI Level 3. Once the level 3 specification is final, its content will be integrated into this specification, which will then replace it. Until then, CSS-UI Level 4 only contains additions and extensions to level 3.
1.1. Purpose
The purpose of this specification is to achieve the following objectives:
- Extend the user interface features in CSS2.1 and [CSS3-UI]
- Provide additional CSS mechanisms to augment or replace other dynamic presentation related features in HTML.
- Introduce directional navigation properties to assist in the construction of user interfaces which make use of a directional navigation model.
2. Module Interactions
This document defines new features not present in earlier specifications. In addition, it replaces and supersedes [CSS3-UI], which itself replaced and superseded the following:
- Section 18.1, section 18.4, and Information on the stacking of outlines defined in Appendix E of Cascading Style Sheets, level 2, revision 1 [CSS21]
- User Interface for CSS3 (16 February 2000) [CSSUI]
3. Box Model addition
3.1. box-sizing property
4. Outline properties
4.1. outline property
4.2. outline-width property
4.3. outline-style property
4.4. outline-color property
5. Resizing & Overflow
5.1. resize property
5.2. Overflow Ellipsis: the text-overflow property
This specification introduces a new value to the text-overflow property: fade, as well as its functional notation variant fade().
Name: | text-overflow |
---|---|
New values: | fade | <fade()> |
Computed value: | As specified, with <length> converted to absolute units |
- fade( <length> | <percentage> )
-
Clip inline content that overflows its line box.
Characters may be only partially rendered.
In addition, the UA must apply a fade out effect
near the edge of the line box,
reaching complete transparency at the edge.
Do we need to define the way the fade out is calculated so that the fading is identical across browsers? It should probably be something like mask-image: linear-gradient(to right, rgba(0,0,0,1), rgba(0,0,0,0)), except applied to the relevant portion of the line only.
The argument determines the distance over which the fade effect is applied. The <percentage> is resolved against the width of the line box. Values lower than 0 are clipped to 0. Values greater than the width of the line box are clipped to the width of the line box.
If the line box is too short to display the fade effect at the desired length, should we drop the effect, or shrink the distance it is applied over until it fits, or clip the end of the fade?
- fade
- Same as fade(), but the distance over which the fading effect is applied is determined by the UA. 1em is suggested as a reasonable value.
How should we deal with things overflowing out of the line box, or overlapping onto it? Should fade apply to the logical content of the line, or to the physical area of the line box, or the intersection of both?
HTML | sample rendering | your browser |
---|---|---|
|
CSS IS AWESOME, YES
|
6. Pointing Devices and Keyboards
6.1. Pointer interaction
6.1.1. cursor property
Amend the definition of auto to show default rather than text over text when user-select is none.
6.2. Insertion caret
6.2.1. Coloring the insertion caret: caret-color
Amend the definition of auto to highlight the fact that when caret-shape is block, ensuring good visibility and contrast means not using currentColor.
6.2.2. Animation of the insertion caret: caret-animation
Name: | caret-animation |
---|---|
Value: | auto | blink | none | fade |
Initial: | auto |
Applies to: | elements that accept input |
Inherited: | yes |
Percentages: | N/A |
Media: | interactive |
Computed value: | Same as specified value. |
Animatable: | no |
On most platforms and in most UAs, the text insertion caret blinks. This property allows the author to control the speed at which it blinks, or to turn off blinking entirely.
- auto
-
The UA determines how the caret should be animated, if at all.
It should match platform conventions,
and may be adjusted based on context.
Note: This is typically rendered as a blinking caret.
- blink
- The UA must display a blinking caret. For accessibility reasons, and based on user preferences, The UA may display a non animated caret instead.
- none
-
The UA must not animate the caret.
Note: This is only about UA driven animations of the caret. If CSS animations are used to animate the caret color, these should still apply normally.
- fade
- The UA must display a caret repeatedly fading in and out, similarly to blink except it appears and disappears progressively rather than suddenly. For accessibility reasons, and based on user preferences, The UA may display a non animated caret instead.
Do we need the accessibility escape hatch on blink and fade?
Would it be enough instead to expect the UI to put caret-animation:fixed !important
in the
user stylesheet when it wants to prevent the caret
from blinking?
The UA determines the speed at which the cursor blinks or fades. It should follow platform conventions and settings.
Note: It is recommended to stop the caret from blinking or fading using caret-animation: none when applying custom animations using [CSS3-ANIMATIONS], to prevent the blinking or fading and the css animation to interfere.
Note: See Guideline 2.3: Seizures: Do not design content in a way that is known to cause seizures [WCAG20].
/* prevent the caret from blinking/flashing */
:read-write { caret-animation: none !important; }
/* prevent changes of caret-color, including animations */
:read-write { caret-color:auto !important; }
UAs that do not have an editable user stylesheet should provide a setting to disable blinking, flashing and animated carets. UAs that do have an editable user stylesheet may want to provide this setting as well. See [WCAG] Guideline 2.2 and Guideline 2.3 for details.
textarea {
caret-animation: none;
caret-color: blue;
animation: caret-alternate 2s step-end infinite;
}
@keyframes caret-alternate {
50% { caret-color: red; }
}
The simulated rendering below illustrates how this should look.
Focus the element below to see how your browser renders it.
6.2.3. Shape of the insertion caret: caret-shape
Name: | caret-shape |
---|---|
Value: | auto | bar | block | underscore |
Initial: | auto |
Applies to: | elements that accept input |
Inherited: | yes |
Percentages: | N/A |
Media: | interactive |
Computed value: | Same as specified value |
Animatable: | no |
This property allows authors to specify the desired shape of the text insertion caret.
Within the context of this definition, character is to be understood as extended grapheme cluster, as defined in [UAX29], and visible character means a character with a non-zero advance measure.
- auto
- The UA determines the shape of the caret. It should match platform conventions, and may be adjusted based on context. For example, if a UA switches between insert mode and overtype mode when the user presses the insert key on their keyboard, it may show a bar caret in insert mode, and a block caret in overtype mode.
- bar
- The UA must render the text insertion caret as a thin bar placed at the insertion point. This means it is between, before, or after characters, not over them. It should be perpendicular to the inline progression direction, although UAs may render it slanted when inserting italic or oblique text.
- block
- The UA must render the text insertion caret as a rectangle overlapping the next visible character following the insertion point. If there is no visible character after the insertion point, the UA must render the caret after the last visible character. UAs may render it as a slanted rectangle when inserting italic or oblique text.
- underscore
- The UA must render the text insertion caret as a thin line under (as defined in [CSS-WRITING-MODES-3] the next visible character following the insertion point. If there is no visible character after the insertion point, the UA must render the caret after the last visible character.
The width of the block and underscore carets should be the advance measure of the next visible character after the insertion point, or 1ch if there is no next visible character or if this information is impractical to determine.
When determining the orientation and appearance of the caret,
UAs must take into account the writing mode [CSS-WRITING-MODES-3] and must apply transformations [CSS-TRANSFORMS-1].
If the edited text is laid out out on a path,
for instance by using the SVG textPath
element,
UAs should also account for this.
The stacking position of the caret is left undefined, within the following constraints:
- The caret must not be obscured by the background of the element
- UAs must render block carets so that the character it overlaps with is not obscured by the caret
caret-shape | Sample rendering | Your browser (focus each cell to see the caret) |
---|---|---|
bar | Lorem ipsum | Lorem Ipsum |
block | Lorem ipsum | Lorem Ipsum |
underscore | Lorem ispum | Lorem Ipsum |
.console {
caret-shape: underscore;
background: black;
color: white;
font-family: monospace;
padding: 1ex;
}
The simulated rendering below illustrates how this should look.
user@host:css-ui-4 $ ls -a
. .. Overview.bs Overview.html
user@host:css-ui-4 $
Focus the element below to see how your browser renders it.
user@host:css-ui-4 $ ls -a . .. Overview.bs Overview.html user@host:css-ui-4 $
6.2.4. Insertion caret shorthand: caret
Name: | caret |
---|---|
Value: | <‘caret-color’> || <‘caret-animation’> || <‘caret-shape’> |
Initial: | auto |
Applies to: | elements that accept input |
Inherited: | yes |
Percentages: | N/A |
Media: | interactive |
Computed value: | See individual properties |
Animatable: | See individual properties |
This property is a shorthand for setting caret-color, caret-animation and caret-shape in one declaration. Omitted values are set to their initial values.
#old-screen {
caret: block 0s;
animation: old-caret 2s infinite;
/*styling of the screen omitted for brevity */
}
@keyframes old-caret {
from, 50% { caret-color: green; }
75%, to { caret-color: transparent; }
}
The simulated rendering below illustrates how this should look.
Focus the element below to see how your browser renders it.
6.3. Keyboard control
6.3.1. Directional focus navigation: the nav-up, nav-right, nav-down, nav-left properties
6.3.2. Obsolete: the ime-mode property
7. User Interaction
7.1. Controlling content selection
The user-select property enables authors to specify which elements in the document can be selected by the user and how. This allows for easier interactions when not all elements are equally useful to select, avoiding accidental selections of neighbouring content.
Name: | user-select |
---|---|
Value: | auto | text | none | contain | all |
Initial: | auto |
Applies to: | all elements |
Inherited: | no |
Percentages: | n/a |
Media: | interactive |
Computed value: | See below |
Animatable: | no |
User Agents must not apply the user-select property to the ::first-line and ::first-letter pseudo elements.
Whether user-select should apply to ::before and ::after is an open question.
The computed value is the specified value, except:
- on editable elements where the computed value is always contain regardless of the specified value
- when the specified value is auto, which computes one of the other values as defined below
For the purpose of this specification,
an editable element is either
an editing host or a mutable form control with textual content,
such as textarea
.
Should there be constraints on what happens to the computed value on elements that are editable descendants of editing hosts? The semantics are not obvious. Maybe none should compute to text, or maybe all values should compute to text.
- auto
-
The computed value of auto is determined as follows:
- If the element is an editable element, the computed value is contain
- Otherwise, if the computed value of user-select on the parent of this element is all, the computed value is all
- Otherwise, if the computed value of user-select on the parent of this element is none, the computed value is none
- Otherwise, the computed value is text
Note: This unusual combination of a non inherited property with an initial value of auto whose computed value depends on the parent element makes it possible to create what is effectively selective inheritance. This was initially proposed by Microsoft in IE to introduce a behavior similar to inheritance except that the contain value does not inherit.
- text
- The element imposes no constraint on the selection.
- none
-
The UA must not allow selections to be started in this element.
A selection started outside of this element must not end in this element. If the user attempts to create such a selection, the UA must instead end the selection range at the element boundary.
Note: As of the time of writing, experimental implementations do not all behave like this. Firefox does. Chrome and Safari almost do: for a selection started after the element and trying to go backwards into the element they behave as specified here, but for a selection started before the element and trying to go into the element they behave as if the element has all and select it entirely. IE does not restrict selections started outside of the element from going into it at all. Another difference is that in Chrome and Safari, if the user attempts to start a selection inside a user-select: none, and to end the selection out of it, a selection will be created from the boundary of the element to the user-designated end-point. Firefox and Internet explorer behave as prescribed in this specification and do not create a selection at all.
However, if this element has descendants on which the computed value of user-select is not none, selections that start and end within these descendants are allowed.
The UA must allow selections to extend across this element, and must exclude this element from such a selection. An exception is made for UAs which do not support multiple ranges per selection, and they may include this element. If the element has descendants on which user-select does not compute to none, these descendants must be included in a selection extending across the element.
As user-select is a UI convenience mechanism, not a copy protection mechanism, the UA may provide an alternative way for the user to explicitly select the text even when user-select is none.
Note: none is not a copy protection mechanism, and using it as such is ineffective: User Agents are allowed to provide ways to bypass it, it will have no effect on legacy User Agents that do not support it, and the user can disable it through the user style sheet or equivalent mechanisms on UAs that do anyway. Instead, none is meant to make it easier for the user to select the content they want, by letting the author disable selection on UI elements that are not useful to select. Tools such as CSS validators, linters or in-browser developer tools are encouraged to use heuristics to detect and warn against incorrect or abusive usage that would hamper usability or violate common user expectations.
- contain
-
UAs must not allow a selection which is started in this element
to be extended outside of this element.
A selection started outside of this element must not end in this element. If the user attempts to create such a selection, the UA must instead end the selection range at the element boundary.
The UA must allow selections to extend across this element, and such selections must include the content of the element.
Note: At the time of writing, experimental implementations behave differently from eachother about selections started outside and selections going into the element. The behavior can be observed even on browsers that do not explicitly support contain by trying to select into a
textarea
or a contenteditable element.Note: This was initially introduced as an experimental feature in Internet Explorer, under the name
user-select: element
. - all
-
The content of the element must be selected atomically:
If a selection would contain part of the element,
then the selection must contain the entire element including all its descendants.
If the element is selected
and the computed value of user-select on its parent is all,
then the parent must be included in the selection, recursively.
If this element has descendants on which the computed value of user-select is not all and if a selection is entirely contained in these descendants, then the selection is not extended to include this whole element.
Note: Selections can include more than just text and extend over images, tables, videos, etc. The behavior when copying and pasting a such selections is out of scope for this specification.
The following additions are made to the UA stylesheet for HTML:
button, meter, progress, select { user-select: none; }
the list above is incomplete, and needs to include
at least the various button-like variants of input
.
8. Form Control Styling
8.1. Switching appearance
While the way most elements in a document look can be fully controlled by CSS, form controls are typically rendered by UAs using native UI controls of the host operating system, which can neither be replicated nor styled using CSS.
This specification introduces the appearance property to provide some control over this behavior. Using appearance: none allows authors to suppress the native style of form controls, so that CSS can be used to fully restyle them.
Name: | appearance |
---|---|
Value: | auto | none |
Initial: | auto |
Applies to: | all elements |
Inherited: | no |
Percentages: | n/a |
Media: | all |
Computed value: | As specified |
Animatable: | no |
Applies To: | all elements |
Should auto compute to none on regular elements? I would say no: If we did that, to be consistent, every time we introduced a new value, we would change what auto computes to on some elements, which doesn’t sounds desirable.
Note: This specification intentionally refrains from making the appearance of all possible form controls and sub-controls available as values, as had previously been attempted by earlier proposals for this property and by several UA vendors in experimental implementations. Experience has shown that such a list would be very long and not practical to maintain, and UAs would need to add non-standard values to account for the behavior of non-standard pseudo-elements sometimes used to implement form controls. Moreover, many values of such an enumeration only make sense on a single element or pseudo-element, and are never used outside of the UA stylesheet. Instead, this specification only provides auto, none. UAs cannot therefore use the appearance property in the UA stylesheet to give each control is native look and feel, and must use appearance:auto instead.
IE supports -webkit-appearance, and also includes the textfield and button values. Presumably this was done due to compatibility problems, so we may need to include it as well.
- auto
-
UAs may render form controls using native controls of the host operating system
or with a look and feel not otherwise expressible in CSS.
Elements other than form controls must be rendered as if none had been specified.
- none
-
The element is rendered following the usual rules of CSS.
Replaced elements other than form controls are not affected by this,
and remain replaced elements.
From controls are not made to look like native controls of the host operating system.
See below for details.
Shouldn’t this be called "normal" instead? none makes it sound like the targeted element will disappear.
On form control elements where the computed value is auto UAs may disregard some CSS properties to ensure that the intended appearance is preserved, or because these property may not be meaningful for the chosen appearance. However, the following properties must not be disregarded:
Are there more properties should include in this list? Should we remove some? Should whitelist the properties that are ok to ignore instead of blacklisting those that are not? Either way, UAs do ignore some properties when rendering form controls, so this specification needs to say something about this.
All decorative visual aspects of a form control which are not caused by a CSS style rule
must be suppressed when the appearance is changed using appearance,
even if the UA’s internal representation for this element
was composed of multiple elements or pseudo elements combined together.
For example, select
is often rendered with an arrow on the right side
indicating that the list will be expanded if the element is clicked,
If the computed value of appearance is none, this
must disappear.
However, the UA must preserve aspects of the form control
which are necessary to operate the control with its original semantics.
This does not include aspects of a control which are merely needed to observe the state the control is in,
only those that are needed for the user to be able to modify the state of the control.
The UA may however give them a different look and feel
as long as it remains possible to operate the control.
For example,
the slider of an <input type=range>
is preserved
(or replaced by an equivalent mechanism)
even if appearance is none as it would otherwise not be possible to change the value of the range with the mouse or touchscreen.
On the other hand,
the check mark in an <input type=checkbox checked>
must be suppressed,
as it merely indicates the state the element is in,
which can be styled in different ways using the :checked selector.
UAs are inconsistent about the preceding two paragraphs. What is specified here attempts to give some logic to what is preserved and what is not, based on the use-cases for appearance.
UAs should include in their User Agent stylesheet style rules to give form controls a recognizable shape when appearance is none.
Note: Authors may therefore need to override these UA style rules to get the styling they intended, possibly by using all: unset.
This usage of the all property would remove focus indicators created by the outline property, which seems undesirable. Using all: revert would not solve it, as it would fail to remove the UA styles as intended. How can we mitigate this?
The behavior and semantics of elements remain defined by the host language, and are not influenced by this property. For example, regardless of the computed value of appearance:
- Elements which can be in different states keep this ability, and the relevant pseudo-classes match as usual.
- If a
select
element is activated, the UI to choose one of the associatedoption
elements is shown (although it may look different). - Event handlers attached to the element trigger as usual.
Conversely, changing the appearance of an element must not cause it to acquire new semantics, pseudo classes, event handlers, etc that it did not initially have. The ability for an element to be focused is also not changed by the appearance property.
input[type=checkbox] {
appearance: none;
all: unset;
width: 1em;
height: 1em;
display: inline-block;
background: red;
}
input[type=checkbox]:checked {
border-radius: 50%;
background: green;
}
<input type="checkbox">
would be rendered as ,
while <input type="checkbox" checked>
would be rendered as ,
and activating (for example by clicking) the element would toggle the state as usual.
Appendix A. Acknowledgments
This appendix is informative.
This specification builds upon [CSS3-UI], which was edited and written for the most part by Tantek Çelik from 1999 to the present, first while representing Microsoft, then as an invited expert, and most recently while representing Mozilla.
Later work on level 3 and on this level 4 was done by Florian Rivoal, working on behalf of Bloomberg.
Thanks to feedback and contributions from Rossen Atanassov, Tab Atkins, L. David Baron, Bert Bos, Matthew Brealey, Rick Byers, Ada Chan, James Craig, Michael Cooper, Axel Dahmen, Michael Day, Micah Dubinko, Elika E., Steve Falkenburg, Andrew Fedoniouk, Al Gilman, Ian Hickson, Bjoern Hoehrmann, Alan Hogan, David Hyatt, Richard Ishida, Sho Kuwamoto, Yves Lafon, Stuart Langridge, Susan Lesch, Peter Linss, Kang-Hao Lu, Masayuki Nakano, Mats Palmgren, Brad Pettit, François Remy, Andrey Rybka, Simon Sapin, Alexander Savenkov, Sebastian Schnitzenbaumer, Lea Verou, Etan Wexler, David Woolley, Frank Yan, Boris Zbarsky, and Domel.
Appendix B. Changes
This appendix is informative.
This appendix describes functional changes from the Level 3 Candidate Recommendation (CR) of 7 Jul 2015.
- The user-select property has been added
- The appearance property has been added
- The fade and fade() values have been added to text-overflow
- The caret shorthand property and the caret-shape and caret-animation properties have been added.
Appendix C. Considerations for Security and Privacy
This appendix is informative.
The W3C TAG is developing a Self-Review Questionnaire: Security and Privacy for editors of specifications to informatively answer.
Per the Questions to Consider
-
Does this specification deal with personally-identifiable information?
No.
-
Does this specification deal with high-value data?
No.
-
Does this specification introduce new state for an origin that persists across browsing sessions?
No.
-
Does this specification expose persistent, cross-origin state to the web?
No.
-
Does this specification expose any other data to an origin that it doesn’t currently have access to?
No.
-
Does this specification enable new script execution/loading mechanisms?
No.
-
Does this specification allow an origin access to a user’s location?
No.
-
Does this specification allow an origin access to sensors on a user’s device?
Yes. The directional focus navigation properties indirectly allow access to the device’s keyboard navigation input mechanism such as arrow keys.
-
Does this specification allow an origin access to aspects of a user’s local computing environment?
No.
-
Does this specification allow an origin access to other devices?
No.
-
Does this specification allow an origin some measure of control over a user agent’s native UI?
Yes. The cursor and caret-* properties enable the page to change the display of the cursor and text insertion caret of the user agent’s native UI. In addition the outline-style property’s auto value (and thus outline shorthand) enable the page to potentially display a native focused element outline presentation around any element.
The appearance property also allows author to turn off native styling and replace it with css based styling.
-
Does this specification expose temporary identifiers to the web?
No.
-
Does this specification distinguish between behavior in first-party and third-party contexts?
No.
-
How should this specification work in the context of a user agent’s "incognito" mode?
No differently.
-
Does this specification persist data to a user’s local device?
No.
-
Does this specification have a "Security Considerations" and "Privacy Considerations" section?
Yes.
-
Does this specification allow downgrading default security characteristics?
No.
Appendix D. Default style sheet additions for HTML
Conformance
Document conventions
Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.
All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]
Examples in this specification are introduced with the words "for example"
or are set apart from the normative text with class="example"
,
like this:
Informative notes begin with the word "Note" and are set apart from the
normative text with class="note"
, like this:
Note, this is an informative note.
Advisements are normative sections styled to evoke special attention and are
set apart from other normative text with <strong class="advisement">
, like
this: UAs MUST provide an accessible alternative.
Conformance classes
Conformance to this specification is defined for three conformance classes:
- style sheet
- A CSS style sheet.
- renderer
- A UA that interprets the semantics of a style sheet and renders documents that use them.
- authoring tool
- A UA that writes a style sheet.
A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.
A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)
An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.
Partial implementations
So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.
Experimental implementations
To avoid clashes with future CSS features, the CSS2.1 specification reserves a prefixed syntax for proprietary and experimental extensions to CSS.
Prior to a specification reaching the Candidate Recommendation stage in the W3C process, all implementations of a CSS feature are considered experimental. The CSS Working Group recommends that implementations use a vendor-prefixed syntax for such features, including those in W3C Working Drafts. This avoids incompatibilities with future changes in the draft.
Non-experimental implementations
Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec.
To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.
Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at https://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.
Index
Terms defined by this specification
- all, in §7.1
- appearance, in §8.1
-
auto
- value for caret-animation, in §6.2.2
- value for caret-shape, in §6.2.3
- value for user-select, in §7.1
- value for appearance, in §8.1
- bar, in §6.2.3
- blink, in §6.2.2
- block, in §6.2.3
- caret, in §6.2.4
- caret-animation, in §6.2.2
- caret-shape, in §6.2.3
- character, in §6.2.3
- contain, in §7.1
- editable element, in §7.1
- fade(), in §5.2
-
fade
- value for text-overflow, in §5.2
- value for caret-animation, in §6.2.2
-
none
- value for caret-animation, in §6.2.2
- value for user-select, in §7.1
- value for appearance, in §8.1
- text, in §7.1
- underscore, in §6.2.3
- user-select, in §7.1
- visible character, in §6.2.3
Terms defined by reference
- [css-cascade-4] defines the following terms:
- [css-masking-1] defines the following terms:
- [css-position-3] defines the following terms:
- [css-pseudo-4] defines the following terms:
- [css-values] defines the following terms:
- [css-writing-modes-3] defines the following terms:
- [CSS21] defines the following terms:
- [HTML] defines the following terms:
- [selectors-4] defines the following terms:
- [SVG2] defines the following terms:
References
Normative References
- [CSS21]
- Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. REC. URL: https://www.w3.org/TR/CSS2
- [HTML]
- Ian Hickson. HTML Standard. Living Standard. URL: https://html.spec.whatwg.org/multipage/
- [SVG2]
- Nikos Andronikos; et al. Scalable Vector Graphics (SVG) 2. 15 September 2015. WD. URL: https://www.w3.org/TR/SVG2/
- [UAX29]
- Mark Davis. Text Boundaries. 25 March 2005. Unicode Standard Annex #29. URL: https://www.unicode.org/unicode/reports/tr29/tr29-9.html
- [CSS-CASCADE-4]
- Elika Etemad; Tab Atkins Jr.. CSS Cascading and Inheritance Level 4. 8 September 2015. WD. URL: https://www.w3.org/TR/css-cascade-4/
- [CSS-MASKING-1]
- Dirk Schulze; Brian Birtles; Tab Atkins Jr.. CSS Masking Module Level 1. 26 August 2014. CR. URL: https://www.w3.org/TR/css-masking-1/
- [CSS-POSITION-3]
- CSS Positioned Layout Module Level 3 URL: https://www.w3.org/TR/css3-positioning/
- [CSS-PSEUDO-4]
- Daniel Glazman; Elika Etemad; Alan Stearns. CSS Pseudo-Elements Module Level 4. 15 January 2015. WD. URL: https://www.w3.org/TR/css-pseudo-4/
- [CSS-TRANSFORMS-1]
- Simon Fraser; et al. CSS Transforms Module Level 1. 26 November 2013. WD. URL: https://www.w3.org/TR/css-transforms-1/
- [CSS-VALUES]
- Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3. 11 June 2015. CR. URL: https://www.w3.org/TR/css-values/
- [CSS-WRITING-MODES-3]
- Elika Etemad; Koji Ishii. CSS Writing Modes Level 3. 20 March 2014. CR. URL: https://www.w3.org/TR/css-writing-modes-3/
- [CSS3-UI]
- Tantek Çelik; Florian Rivoal. CSS Basic User Interface Module Level 3 (CSS3 UI). 7 July 2015. CR. URL: https://www.w3.org/TR/css-ui-3/
- [RFC2119]
- S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
- [SELECTORS-4]
- Selectors Level 4 URL: https://www.w3.org/TR/selectors4/
Informative References
- [CSS1]
- Håkon Wium Lie; Bert Bos. Cascading Style Sheets (CSS1) Level 1 Specification. 11 April 2008. REC. URL: https://www.w3.org/TR/CSS1/
- [CSS2]
- Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. REC. URL: https://www.w3.org/TR/CSS2
- [CSSUI]
- Tantek Çelik. User Interface for CSS3. 2 August 2002. URL: https://www.w3.org/TR/css3-userint
- [WCAG]
- Wendy Chisholm; Gregg Vanderheiden; Ian Jacobs. Web Content Accessibility Guidelines 1.0. 5 May 1999. REC. URL: https://www.w3.org/TR/WAI-WEBCONTENT
- [WCAG20]
- Ben Caldwell; et al. Web Content Accessibility Guidelines (WCAG) 2.0. 11 December 2008. REC. URL: https://www.w3.org/TR/WCAG20/
- [CSS3-ANIMATIONS]
- Dean Jackson; et al. CSS Animations. 19 February 2013. WD. URL: https://www.w3.org/TR/css3-animations/
Property Index
Name | Value | Initial | Applies to | Inh. | %ages | Media | Animatable | Computed value |
---|---|---|---|---|---|---|---|---|
caret-animation | auto | blink | none | fade | auto | elements that accept input | yes | N/A | interactive | no | Same as specified value. |
caret-shape | auto | bar | block | underscore | auto | elements that accept input | yes | N/A | interactive | no | Same as specified value |
caret | <‘caret-color’> || <‘caret-animation’> || <‘caret-shape’> | auto | elements that accept input | yes | N/A | interactive | See individual properties | See individual properties |
user-select | auto | text | none | contain | all | auto | all elements | no | n/a | interactive | no | See below |
appearance | auto | none | auto | all elements | no | n/a | all | no | As specified |
Issues Index
caret-animation:fixed !important
in the
user stylesheet when it wants to prevent the caret
from blinking? ↵ input
. ↵