CSS Basic User Interface Module Level 3 (CSS3 UI)

W3C Working Draft 17 January 2012

This version:
Latest version:
Editor's draft:
Previous version:
Issues list:
www-style@w3.org with subject line “[css3-ui] … message topic …” (archives)
(Mozilla Foundation, and before at Microsoft Corporation) <>


This section is informative.

CSS (Cascading Style Sheets) is a language for describing the rendering of HTML and XML documents on screen, on paper, in speech, etc. It uses various selectors, properties and values to style basic user interface elements in a document. This specification describes those user interface related selectors, properties and values that are proposed for CSS level 3 to style HTML and XML (including XHTML and XForms). It includes and extends user interface related features from the selectors, properties and values of CSS level 2 revision 1 and Selectors specifications.

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 http://www.w3.org/TR/.

Publication as a 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 “css3-ui” in the subject, preferably like this: “[css3-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 specification is a Last Call Working Draft, although it was previously a Candidate Recommendation. It has been returned to Last Call Working Draft because this draft removes features that were not implemented sufficiently to advance to Proposed Recommendation, and had not been previously listed as at risk, as required by the W3C Process. This draft also adds a couple of new properties and values. See Appendix C. Changes for further details. All persons are encouraged to review this document and send comments to the www-style mailing list as described above. The deadline for comments is four weeks after the date of publication in the header or 14 February 2012, whichever is sooner.

Candidate Recommendation Exit Criteria

For this specification to enter the Proposed Recommendation stage, the following conditions shall be met:

  1. There must be at least two interoperable implementations for every feature. For the purposes of this criterion, we define the following terms:


    A section or subsection of the specification.


    passing the respective test cases in the test suite, or, if the implementation is not a web browser, equivalent tests. Every relevant test in the test suite should have an equivalent test created if such a user agent (UA) is to be used to claim interoperability. In addition if such a UA is to be used to claim interoperability, then there must one or more additional UAs which can also pass those equivalent tests in the same way for the purpose of interoperability. The equivalent tests must be made publicly available for the purposes of peer review.


    a user agent which:

    1. implements the feature.
    2. is available (i.e. publicly downloadable or available through some other public point of sale mechanism). This is the "show me" requirement.
    3. is shipping (i.e. development, private or unofficial versions are insufficient).
    4. is not experimental (i.e. is intended for a wide audience and could be used on a daily basis).
  2. A minimum of six months of the CR period must have elapsed. This is to ensure that enough time is given for any remaining major errors to be caught.

  3. The CR period will be extended if implementations are slow to appear.

  4. Features that are at risk (see the below list) will be dropped (thus reducing the list of "all" features mentioned above) if two or more interoperable implementations of those features are not found by the end of the CR period, or if sufficient and adequate tests (by judgment of the Working Group) have not been produced for those features by the end of the CR period.

A test suite and a report on implementations will be provided before the document becomes a Proposed Recommendation.

Features at risk

The Working Group has identified the following features as at risk of being removed from CSS Basic User Interface Module Level 3 when exiting CR. Implementors are urged to implement these features, if they wish to see these features remain in this specification. All other features are either defined in a normative reference (e.g. CSS 2.1 [CSS21] or Selectors [SELECT]) or are believed to have two or more implementations, and thus will not be dropped without returning to last call.


This section is informative.

This document is one of the "modules" for the upcoming CSS3 specification. It not only describes the user interface related properties and values that already exist in CSS1 [CSS1] and CSS2.1 [CSS21], but introduces new properties and values for CSS3 as well. The Working Group doesn't expect that all implementations of CSS3 will implement all properties or values. Instead, there will probably be a small number of variants of CSS3, so-called "profiles".

This document is the result of the merging of relevant parts of the following Recommendations and Working Drafts, and the addition of some new features.

This specification contains:

Table of contents

1. Introduction

CSS3 is a set of modules, divided up and profiled in order to simplify the specification, and to allow implementors the flexibility of supporting the particular modules appropriate for their implementations.

This module describes selectors and CSS properties which enable authors to style user interface related states, element fragments, properties and values.

Section 2.1 of CSS1 [CSS1] and Chapter 18 of CSS2 [CSS2] introduced several user interface related pseudo-classes, properties and values. Section 6.6.4 of Selectors [SELECT] also describes several additional user interface related pseudo-classes (and one pseudo-element).

This Working Draft extends them to provide the ability, through CSS, to style elements based upon additional user interface states, to style fragments of user interface elements, and to alter the dynamic presentation of elements in ways previously only available through specific HTML4/XHTML1 elements and attributes.

1.1. Purpose

The purpose of this specification is to achieve the following objectives:

2. Conformance

2.1. Definitions

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 (see [RFC2119]). However, for readability, these words do not typically appear in all uppercase letters in this specification.

Additional key words, e.g. "User agent (UA)", are defined by CSS 2.1 ([CSS21], section 3.1).

2.2. Classes of products

The following classes of products (many of which overlap) should consider implementing this specification:

2.3. Extensions

This specification does not define any explicit extension mechanisms. If an implementation needs to extend the functionality of this specification, it must follow any/all guidelines and requirements of extensions as defined in CSS2.1, e.g. Vendor-specific extensions ([CSS21], section

3. Dependencies on other modules

This CSS3 module depends on the following other specifications.

The following work is related to the CSS Basic User Interface Module Level 3 (CSS3 Basic UI).

This specification does not define what is a form element.

4. User Interface Selectors

4.1. User interface states: pseudo-classes

The Selectors specification defines several user interface selectors ([SELECT], sections 6.6.1 and 6.6.4) which represent user interface states:

These pseudo-classes as defined by [SELECT] are included in this specification by reference.

CSS 2.1 [CSS21] specifies additional details for some of the selectors mentioned, above and beyond Selectors.

4.1.1. :active details

In addition, on systems with more than one mouse button, :active is clarified to apply only to the primary or primary activation button (typically the "left" mouse button), and any aliases thereof.

4.1.2. The indeterminate-value pseudo-class ‘:indeterminate

The :indeterminate pseudo-class applies to UI elements whose value is in an indeterminate state. For example, radio and checkbox elements can be toggled between checked and unchecked states, but are sometimes in an indeterminate state, neither checked nor unchecked. Similarly a progress meter can be in an indeterminate state when the percent completion is unknown.

Like the :checked pseudo-class, :indeterminate applies to all media. Components of a radio-group initialized with no pre-selected choice, for example, would be :indeterminate even in a static display.

New user interface state pseudo-classes

In addition to the above-mentioned pseudo-classes, this specification introduces several new pseudo-classes to define additional user interface states.

Specifically, these new states (except for :default) are provided as a way to style elements which are in the respective states as defined by XForms [XFORMS11].

4.1.3. :default

The :default selector applies to the one or more UI elements that are the default among a set of similar elements. This selector typically applies to context menu items, buttons, and select lists/menus.

One example is the default submit button among a set of buttons. Another example is the default option from a popup menu. Multiple elements in a select-many group could have multiple :default elements, like a selection of pizza toppings for example.

4.1.4. :valid and :invalid

An element is :valid or :invalid when it is, respectively, valid or invalid with respect to data validity semantics defined by a different specification (e.g. [XFORMS11]). An element which lacks data validity semantics is neither :valid nor :invalid. This is different from an element which otherwise has no constraints. Such an element would always be :valid.

4.1.5. :in-range and :out-of-range

The :in-range and :out-of-range pseudo-classes apply only to elements that have range limitations. An element is :in-range or :out-of-range when the value that the element is bound to is in range or out of range of the presentation (e.g. visual or spoken representation) of the element respectively. An element that lacks data range limits or is not a form control is neither :in-range nor :out-of-range. E.g. a slider element with a value of 11 presented as a slider control that only represents the values from 1-10 is :out-of-range. Another example is a menu element with a value of "E" that happens to be presented as a popup menu that only has choices "A", "B" and "C".

4.1.6. :required and :optional

A form element is :required or :optional if a value for it is, respectively, required or optional before the form it belongs to is submitted. Elements that are not form elements are neither required nor optional.

4.1.7. :read-only and :read-write

An element whose contents are not user-alterable is :read-only. However, elements whose contents are user-alterable (such as text input fields) are considered to be in a :read-write state. In typical documents, most elements are :read-only. However it may be possible (e.g. in the context of an editor) for any element to become :read-write.

4.2. User interface element fragments: pseudo-elements

In addition to the above-mentioned pseudo-element, this specification introduces four new pseudo-elements to provide access to additional user interface element fragments.

Specifically, these new pseudo-elements are provided as a way to style user interface fragments as defined by XForms [XFORMS11].

Note: The ::value, ::choices, ::repeat-item, and ::repeat-index pseudo-elements are all at risk.

4.2.1. ::value

A form element may contain both a label for its data value, and the data value itself. For such elements, the ::value pseudo-element selects the representation of just the data value itself, in order to style its appearance.


fictional markup and illustration

Here is an example which illustrates the ::value of a text input field with fictional markup which is then styled with CSS.

sample XForms fragment with fictional markup:

  <label>Zip code<label>
sample CSS:

input { border:dashed }
label { border:dotted }
input::value { border:solid }
an HTML+CSS approximation of this example

Spacing (in the form of padding) has been added to the above approximation to separate the borders and make the individual (pseudo-)elements easier to distinguish.

The ::value pseudo-element is similar to an inline-level element, but with certain restrictions. The following properties apply to ::value pseudo-element: font properties, color property, background properties, ‘word-spacing’, ‘letter-spacing’, ‘text-decoration’, ‘vertical-align’, ‘text-transform’, ‘line-height’. UAs may apply other properties as well.

4.2.2. ::choices

Similarly, a form element which represents a list of options may contain both a label for the list, and the list of choices itself. For such elements, the ::choices pseudo-element selects the representation of just the list of choices themselves, in order to style their appearance.

A list of radio buttons can also be selected with the ::choices pseudo-element, and the currently chosen radio button can be selected with the ::value pseudo-element.

4.2.3. ::repeat-item

The ::repeat-item pseudo-element represents a single item from a repeating sequence. It is generated as a parent to all the elements in a single repeating item. Each ::repeat-item is associated with a particular instance data node, and is affected by the model item properties (e.g. ‘relevant’) found there, as the related style properties will cascade to the child elements.

4.2.4. ::repeat-index

The ::repeat-index pseudo-element represents the current item of a repeating sequence. It takes the place of the ::repeat-item as a parent of all the elements in the index repeating item.

Note. Any style declarations that an author wants to apply to all repeat items, including the index, must be done so by using both ::repeat-item and ::repeat-index selectors. Styles that are only applied to ::repeat-item will not automatically be applied to the respective ::repeat-index.


::repeat-item and ::repeat-index fictional markup

Here is an example that illustrates both ::repeat-item and ::repeat-index, since they are often both available and used at the same time. Assume appropriate namespace declarations were made in a header somewhere preceding the code in the example.

The following markup snippet uses XHTML and XForms:

<html:table xforms:repeat-nodeset="...">
      <html:td><xforms:input ref="..."/><xforms:input ref="..."/></html:td>

The following style rules are used to style all the repeated items and the current repeated item.

html|tr::repeat-item { outline: medium solid; color:gray }
html|tr::repeat-index { outline: medium dashed; color:black }

The following fictional markup shows the state of the above markup when through user interaction the XForm contains three of the repeated items, where the third item is current.

<html:table xforms:repeat-nodeset="...">
   <html:td><xforms:input ref="..."/><xforms:input ref="..."/></html:td>
   <html:td><xforms:input ref="..."/><xforms:input ref="..."/></html:td>
   <html:td><xforms:input ref="..."/><xforms:input ref="..."/></html:td>

Note. The ::repeat-index pseudo-element takes the place of the ::repeat-item rather than being nested inside as a separate element. Thus just like :link or :visited are mutually exclusive for selecting hyperlinks, only one will exist and apply to a particular repeated item at any point.

5. Element icons

5.1. content property addition

Name: content
New Value(s): icon
Initial: same as CSS 2.1
Applies to: same as CSS 2.1
Inherited: same as CSS 2.1
Percentages: same as CSS 2.1
Media: same as CSS 2.1
Computed value: the keyword ‘icon’ if specified as such, otherwise same as CSS 2.1
The (pseudo-)element is replaced in its entirety by the resource referenced by its icon property, and treated as a replaced element.

Note. It is expected that the next draft of the CSS3 Generated Content module [CSS3GENCON] will include and superset this functionality.

Note: The ‘icon’ value is at risk.

5.2. icon property

Name: icon
Value: auto | <uri> [, <uri>]* | inherit
Initial: auto
Applies to: all elements
Inherited: no
Percentages: N/A
Media: all
Computed value: as specified, except with any relative URLs converted to absolute
Use a default generic icon provided by the user agent.
URIs (see [URI], [RFC1738] and [RFC1808]) provide a way of identifying resources. The <uri> value(s) in this property refer to one or more icons in a comma delimited list. The user agent loads the referenced icons one by one until it finds one that it is able to render. This permits the usage of multiple different icon formats for various platforms, and various media for that matter.

The icon property provides the author the ability to style any arbitrary element with an iconic equivalent. An element's icon is not used/rendered unless the content property is set to the value ‘icon’ (see above). Documents whose elements have icons assigned to them can be more easily viewed by users who find too much text distracting.


Representing elements with icons

This example uses the above icon features to display icons in place of images and objects.

img,object { content:icon }
  /* note that the CSS3 Generated Content module [CSS3GENCON]
     expands the 'content' property to apply to all elements. */
img { icon:url(imgicon.png); }
  /* provide a custom icon for images */
object { icon:url(objicon.png); }
  /* provide a different custom icon for objects */

Note: The ‘icon’ property is at risk.

6. Box Model addition

6.1. box-sizing property

Name: box-sizing
Value: content-box | padding-box | border-box | inherit
Initial: content-box
Applies to: all elements that accept width or height
Inherited: no
Percentages: N/A
Media: visual
Computed value: specified value
This is the behavior of width and height as specified by CSS2.1. The specified width and height (and respective min/max properties) apply to the width and height respectively of the content box of the element. The padding and border of the element are laid out and drawn outside the specified width and height.
The specified width and height (and respective min/max properties) on this element determine the padding box of the element. That is, any padding specified on the element is laid out and drawn inside this specified width and height. The content width and height are calculated by subtracting the padding widths of the respective sides from the specified width and height properties. As the content width and height cannot be negative ([CSS21], section 10.2), this computation is floored at 0.
The specified width and height (and respective min/max properties) on this element determine the border box of the element. That is, any padding or border specified on the element is laid out and drawn inside this specified width and height. The content width and height are calculated by subtracting the border and padding widths of the respective sides from the specified width and height properties. As the content width and height cannot be negative ([CSS21], section 10.2), this computation is floored at 0.

Note. This is the behavior of width and height as commonly implemented by legacy HTML user agents for replaced elements and input elements.


Using box-sizing to evenly share space

This example uses box-sizing to evenly horizontally split two divs with fixed size borders inside a div container, which would otherwise require additional markup.

sample CSS:

div.container {
	border:1em solid black;

div.split {
	border:1em silver ridge;
sample HTML fragment:

<div class="container">
<div class="split">This div occupies the left half.</div>
<div class="split">This div occupies the right half.</div>
demonstration of sample CSS and HTML:
This div should occupy the left half.
This div should occupy the right half.
The two divs above should appear side by side, each (including borders) 50% of the content width of their container. If instead they are stacked one on top of the other then your browser does not support box-sizing.

Note: The ‘padding-box’ value is at risk.

7. Outline properties

At times, style sheet authors may want to create outlines around visual objects such as buttons, active form fields, image maps, etc., to make them stand out. Outlines differ from borders in the following ways:

  1. Outlines do not take up space.
  2. Outlines may be non-rectangular.

The outline properties control the style of these dynamic outlines.

7.1. outline property

Name: outline
Value: [ <‘outline-color’> || <‘outline-style’> || <‘outline-width’> ] | inherit
Initial: see individual properties
Applies to: all elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: see individual properties

7.2. outline-width property

Name: outline-width
Value: <border-width> | inherit
Initial: medium
Applies to: all elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: absolute length; ‘0’ if the outline style is ‘none’.

7.3. outline-style property

Name: outline-style
Value: auto | <border-style> | inherit
Initial: none
Applies to: all elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: specified value

7.4. outline-color property

Name: outline-color
Value: <color> | invert | inherit
Initial: invert
Applies to: all elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: The computed value for ‘invert’ is ‘invert’. For <color> values, the computed value is as defined for the [CSS3COLOR] color property.

The outline created with the outline properties is drawn "over" a box, i.e., the outline is always on top, and doesn't influence the position or size of the box, or of any other boxes. Therefore, displaying or suppressing outlines does not cause reflow.

Outlines may be non-rectangular. For example, if the element is broken across several lines, the outline should be an outline or minimum set of outlines that encloses all the element's boxes. Each part of the outline should be fully connected rather than open on some sides (as borders on inline elements are when lines are broken). The parts of the outline are not required to be rectangular. The position of the outline may be affected by descendant boxes. User agents should use an algorithm for determining the outline that encloses a region appropriate for conveying the concept of focus to the user.

The outline-width property accepts the same values as border-width ([CSS21], section 8.5.1).

The outline-style property accepts the same values as border-style ([CSS21], section 8.5.3), except that ‘hidden’ is not a legal outline style. In addition, in CSS3, outline-style accepts the value ‘auto’. The ‘auto’ value permits the user agent to render a custom outline style, typically a style which is either a user interface default for the platform, or perhaps a style that is richer than can be described in detail in CSS, e.g. a rounded edge outline with semi-translucent outer pixels that appears to glow. As such, this specification does not define how the outline-color is incorporated or used (if at all) when rendering ‘auto’ style outlines. User agents may treat ‘auto’ as ‘solid’.

The outline-color property accepts all colors, as well as the keyword ‘invert’. ‘Invert’ is expected to perform a color inversion on the pixels on the screen. This is a common trick to ensure the focus border is visible, regardless of color background.

Conformant UAs may ignore the ‘invert’ value on platforms that do not support color inversion of the pixels on the screen. If the UA does not support the ‘invert’ value then the initial value of the outline-color property is the ‘currentColor[CSS3COLOR] keyword.

The outline property is a shorthand property, and sets all three of outline-style, outline-width, and outline-color.

Note. The outline is the same on all sides. In contrast to borders, there are no ‘outline-top’ or ‘outline-left’ etc. properties.

This specification does not define how multiple overlapping outlines are drawn, or how outlines are drawn for boxes that are partially obscured behind other elements.


Here's an example of drawing a thick outline around a BUTTON element:

button { outline: thick solid }

Graphical user interfaces may use outlines around elements to tell the user which element on the page has the focus. These outlines are in addition to any borders, and switching outlines on and off should not cause the document to reflow. The focus is the subject of user interaction in a document (e.g., for entering text, selecting a button, etc.).


For example, to draw a thick black line around an element when it has the focus, and a thick red line when it is active, the following rules can be used:

:focus  { outline: thick solid black }
:active { outline: thick solid red }

Note. Since the outline does not affect formatting (i.e., no space is left for it in the box model), it may well overlap other elements on the page.

7.5. outline-offset property

By default, the outline is drawn starting just outside the border edge. However, it is possible to offset the outline and draw it beyond the border edge.

Name: outline-offset
Value: <length> | inherit
Initial: 0
Applies to: all elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: <length> value in absolute units (px or physical).

If the computed value of outline-offset is anything other than 0, then the outline is outset from the border edge by that amount.


For example, to leave 2 pixels of space between a focus outline and the element that has the focus, or is active, the following rule can be used:

:focus,:active  { outline-offset: 2px }

8. Resizing & Overflow

CSS2.1 provides a mechanism for controlling the appearance of a scrolling mechanism (e.g. scrollbars) on block container elements. This specification adds to that a mechanism for controlling user resizability of elements as well as the ability to specify text overflow behavior.

8.1. resize property

The resize property allows the author to specify whether or not an element is resizable by the user, and if so, along which axis/axes.

Name: resize
Value: none | both | horizontal | vertical | inherit
Initial: none
Applies to: elements with overflow other than visible
Inherited: no
Percentages: N/A
Media: visual
Computed value: specified value.
The UA does not present a resizing mechanism on the element, and the user is given no direct manipulation mechanism to resize the element.
The UA presents a bidirectional resizing mechanism to allow the user to adjust both the height and the width of the element.
The UA presents a unidirectional horizontal resizing mechanism to allow the user to adjust only the width of the element.
The UA presents a unidirectional vertical resizing mechanism to allow the user to adjust only the height of the element.

Currently it is possible to control the appearance of the scrolling mechanism (if any) on an element using the overflow property (e.g. ‘overflow: scroll’ vs. ‘overflow: hidden’ etc.). The purpose of the resize property is to also allow control over the appearance and function of the resizing mechanism (e.g. a resize box or widget) on the element.

Note. The resizing mechanism is NOT the same as the scrolling mechanism. The scrolling mechanism allows the user to determine which portion of the contents of an element is shown. The resizing mechanism allows the user to determine the size of the element.

The resize property applies to elements whose computed overflow value is something other than ‘visible’. If overflow is different in a particular axis (i.e. overflow-x vs. overflow-y), then this property applies to the dimension(s) which do not have the value ‘visible’.

When an element is resized by the user, the user agent keeps track of a resize factor (which is initially 1.0) for the width and height, which it then applies to the computed width and height as part of determining the used width and height. The element's contents (and surroundings) are reformatted as necessary.

The resize factor introduces a step in width/height calculations and formatting as described in chapter 10 of CSS2.1. Specifically the following step is inserted between steps 1 and 2 of the algorithm in section 10.4 and 10.7 in CSS2.1 [CSS21], where [dimension] is ‘width’ for 10.4 and ‘height’ for 10.7.

1b. If the resize [dimension] factor is not 1.0, then the tentative used [dimension] is multiplied by that factor, and the rules above are applied again, but this time using the result of that multiplication as the computed value for ‘[dimension]’.

With regard to interactivity and the Document Object Model (DOM), the resize factor on an element lasts the lifetime of the element, however, if the resize property itself is altered (e.g. via pseudo-class change or via DOM manipulation), then the resize factor is reset to 1.0.

The precise direction of resizing (i.e. altering the top left of the element or altering the bottom right) may depend on a number of factors including whether the element is absolutely positioned, whether it is positioned using the right and bottom properties, whether the language of the element is right-to-left etc. The precise direction of resizing is left to the UA to properly determine for the platform.

The user agent may restrict the resizing range to something suitable, such as between the original formatted size of the element, and large enough to encompass all the element's contents.


For example, to make iframes scrollable and resizable, the following rule can be used:


8.2. Overflow Ellipsis: the ‘text-overflow’ property

Name: text-overflow
Value: ( clip | ellipsis | <string> ){1,2} | inherit
Initial: clip
Applies to: block containers
Inherited: no
Percentages: N/A
Media: visual
Computed value: as specified

This property specifies rendering when inline content overflows its block container element ("the block") in its inline progression direction that has overflow other than visible. Text can overflow for example when it is prevented from wrapping (e.g. due to ‘white-space:nowrap’ or a single word is too long to fit). Values have the following meanings:

Clip inline content that overflows. Characters may be only partially rendered.
Render an ellipsis character (U+2026) to represent clipped inline content. Implementations may substitute a more language/script-appropriate ellipsis character, or three dots "..." if the ellipsis character is unavailable.
Render the given string to represent clipped inline content. The given string is treated as an independent paragraph for bidi purposes.

Note: The <string> value, and the 2-value syntax "{1,2}" and functionality are all at risk.

The term "character" is used in this property definition for better readability and means "grapheme cluster" [UAX29] for implementation purposes.

If there is one value, it applies only to the end line edge. If there are two values, the first value applies to the left edge, and the second value applies to the right edge.

For the ellipsis and string values, implementations must hide characters and atomic inline-level elements at the applicable edge(s) of the line as necessary to fit the ellipsis/string. Place the ellipsis/string immediately adjacent to the applicable edge(s) of the remaining inline content. The first character or atomic inline-level element on a line must be clipped rather than ellipsed.

ellipsing details


text-overflow examples

These examples demonstrate setting the text-overflow of a block container element that has text which overflows its dimensions:

sample CSS for a div:
div { 
  width:3.2em; padding:.2em; border:solid .1em black; margin:1em 0;
sample HTML fragments, renderings, and your browser:
HTML sample rendering your browser
First, a box with text drawing outside of it.
<div style="text-overflow:clip; overflow:hidden">
Second, a similar box with the text clipped outside the box.
<div style="text-overflow:ellipsis; overflow:hidden">
Third, a similar box with an ellipsis representing the clipped text.
<div style="text-overflow:ellipsis; overflow:hidden">
Fourth, a box with a nested paragraph demonstrating anonymous block boxes equivalency and non-inheritance into a nested element.



Note: the side of the line that the ellipsis is placed depends on the ‘direction’ of the block. E.g. an overflow hidden right-to-left (direction:rtl) block clips inline content on the left side, thus would place a text-overflow ellipsis on the left to represent that clipped content.

ellipsis interaction with scrolling interfaces

This section applies to elements with text-overflow other than ‘clip’ (non-clip text-overflow) and overflow:scroll.

When an element with non-clip text-overflow has overflow of scroll in the inline progression dimension of the text, and the browser provides a mechanism for scrolling (e.g. a scrollbar on the element, or a touch interface to swipe-scroll, etc.), there are additional implementation details that provide a better user experience:

When an element is scrolled (e.g. by the user, DOM manipulation, or overflow-style [CSS3MARQUEE]), more of the element's content is shown. The value of text-overflow should not affect whether more of the element's content is shown or not. If a non-clip text-overflow is set, then as more content is scrolled into view, implementations should show whatever additional content fits, only truncating content which would otherwise be clipped (or is necessary to make room for the ellipsis/string), until the element is scrolled far enough to display the edge of the content at which point that content should be displayed rather than an ellipsis/string.

As some content is scrolled into view, it is likely that other content may scroll out of view on the other side. If that content's block container element is the same that's doing the scrolling, then implementations should render an ellipsis/string in place of the clipped content, with the same details as described in the value definition above, except that the ellipsis/string is drawn in the start (rather than end) of the block's direction (per the direction property).

While the content is being scrolled, implementations may adjust their rendering of ellipses/strings (e.g. align to the box edges rather than line edges).

If there is insufficient space for both start and end ellipses/strings, then only the end ellipsis/string should be rendered.

9. Pointing Devices and Keyboards

9.1. Pointer interaction

9.1.1. cursor property

Name: cursor
Value: [ [<uri> [<x> <y>]?,]*
[ auto | default | none |
context-menu | help | pointer | progress | wait |
cell | crosshair | text | vertical-text |
alias | copy | move | no-drop | not-allowed |
e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out
] ] | inherit
Initial: auto
Applies to: all elements
Inherited: yes
Percentages: N/A
Media: visual, interactive
Computed value: as specified, except with any relative URLs converted to absolute

This property specifies the type of cursor to be displayed for the pointing device when over the element's border, padding, and content. Values have the following meanings:

image cursors
The user agent retrieves the cursor from the resource designated by the URI. If the user agent cannot handle the first cursor of a list of cursors, it must attempt to handle the second, etc. If the user agent cannot handle any user-defined cursor, it must use the cursor keyword at the end of the list. The optional <x> and <y> coordinates identify the exact position within the image which is the pointer position (i.e., the hotspot).
Each is a <number>. The x-coordinate and y-coordinate of the position in the cursor's coordinate system (left/top relative) which represents the precise position that is being pointed to. If the values are unspecified, then the intrinsic hotspot defined inside the image resource itself is used. If both the values are unspecific and the referenced cursor has no defined hotspot, the effect is as if a value of "0 0" were specified.
general purpose cursors
The UA determines the cursor to display based on the current context.
The platform-dependent default cursor. Often rendered as an arrow.
No cursor is rendered for the element.
A context menu is available for the object under the cursor. Often rendered as an arrow with a small menu-like graphic next to it.
Help is available for the object under the cursor. Often rendered as a question mark or a balloon.
The cursor is a pointer that indicates a link.
A progress indicator. The program is performing some processing, but is different from ‘wait’ in that the user may still interact with the program. Often rendered as a spinning beach ball, or an arrow with a watch or hourglass.
Indicates that the program is busy and the user should wait. Often rendered as a watch or hourglass.
selection cursors
Indicates that a cell or set of cells may be selected. Often rendered as a thick plus-sign with a dot in the middle.
A simple crosshair (e.g., short line segments resembling a "+" sign). Often used to indicate a two dimensional bitmap selection mode.
Indicates text that may be selected. Often rendered as a vertical I-beam. User agents may automatically display a horizontal I-beam/cursor (e.g. same as the ‘vertical-text’ keyword) for vertical text, or for that matter, any angle of I-beam/cursor for text that is rendered at any particular angle.
Indicates vertical-text that may be selected. Often rendered as a horizontal I-beam.
drag and drop cursors
Indicates an alias of/shortcut to something is to be created. Often rendered as an arrow with a small curved arrow next to it.
Indicates something is to be copied. Often rendered as an arrow with a small plus sign next to it.
Indicates something is to be moved.
Indicates that the dragged item cannot be dropped at the current cursor location. Often rendered as a hand or pointer with a small circle with a line through it.
Indicates that the requested action will not be carried out. Often rendered as a circle with a line through it.
resizing and scrolling cursors
e-resize, n-resize, ne-resize, nw-resize, s-resize, se-resize, sw-resize, w-resize
Indicates that some edge is to be moved. For example, the ‘se-resize’ cursor is used when the movement starts from the south-east corner of the box.
ew-resize, ns-resize, nesw-resize, nwse-resize
Indicates a bidirectional resize cursor.
Indicates that the item/column can be resized horizontally. Often rendered as arrows pointing left and right with a vertical bar separating them.
Indicates that the item/row can be resized vertically. Often rendered as arrows pointing up and down with a horizontal bar separating them.
Indicates that the something can be scrolled in any direction. Often rendered as arrows pointing up, down, left, and right with a dot in the middle.
zooming cursors
zoom-in, zoom-out
Indicates that something can be zoomed (magnified) in or out, and often rendered as a magnifying glass with a "+" or "-" in the center of the glass, for ‘zoom-in’ and ‘zoom-out’ respectively.

The UA may treat unsupported values as ‘auto’. E.g. on platforms that do not have a concept of a ‘context-menu’ cursor, the UA may render ‘default’ or whatever is appropriate.

Example: cursor fallback

Here is an example of using several cursor values.

:link,:visited { 
    cursor: url(example.svg#linkcursor), 
            url(hyper.png) 2 3, 

This example sets the cursor on all hyperlinks (whether visited or not) to an external SVG cursor ([SVG10], section 16.8.3). User agents that don't support SVG cursors would simply skip to the next value and attempt to use the "hyper.cur" cursor. If that cursor format was also not supported, the UA could attempt to use the "hyper.png" cursor with the explicit hot spot. Finally if the UA does not support any of those image cursor formats, the UA would skip to the last value and simply render the ‘pointer’ cursor.

9.2. Keyboard control

The nav-index property is an input-method-neutral way of specifying the sequential navigation order (also known as "tabbing order").

Name: nav-index
Value: auto | <number> | inherit
Initial: auto
Applies to: all enabled elements
Inherited: no
Percentages: n/a
Media: interactive
Computed value: specified value.
The element's sequential navigation order is assigned automatically by the user agent.
The number (which is non-zero and positive) indicates the sequential navigation order for the element. ‘1’ means first. Elements with the same nav-index value are navigated in document order when that nav-index value is being navigated.

This property is a replacement for the HTML4/XHTML1 attribute ‘tabindex’ ([HTML401], section 17.11.1). Borrowed and slightly rephrased from the HTML4 Recommendation:

This property specifies the position of the current element in the sequential navigation order for the current document.

The sequential navigation order defines the order in which elements will receive focus when navigated by the user via the keyboard. The sequential navigation order may include elements nested within other elements.

Elements that may receive focus should be navigated by user agents according to the following rules:

  1. Those elements that support the nav-index property and assign a positive value to it are navigated first. Navigation proceeds from the element with the lowest nav-index value to the element with the highest value. Values need not be sequential nor must they begin with any particular value. Elements that have identical nav-index values should be navigated in document order.
  2. Those elements that do not support the nav-index property or support it and assign it a value of ‘auto’ are navigated next. These elements are navigated in document order.
  3. Elements that are disabled do not participate in the sequential navigation order.

The actual key sequence that causes sequential navigation or element activation depends on the configuration of the user agent (e.g., the "tab" key is often used for sequential navigation, and the "enter" key is used to activate a selected element).

User agents may also define key sequences to navigate the sequential navigation order in reverse. When the end (or beginning) of the tabbing order is reached, user agents may circle back to the beginning (or end). The key combination "shift-tab" is often used for reverse sequential navigation.

Note: The ‘nav-index’ property is at risk.

Name: nav-up, nav-right, nav-down, nav-left
Value: auto | <id> [ current | root | <target-name> ]? | inherit
Initial: auto
Applies to: all enabled elements
Inherited: no
Percentages: N/A
Media: interactive
Computed value: as specified
The user agent automatically determines which element to navigate the focus to in response to directional navigational input.

The <id> value consists of a ‘#’ character followed by an identifier, similar to a fragment identifier in a URL. It indicates the element to which the focus is navigated to in response to directional navigation input respective to the specific property.

If the <id> refers to the currently focused element, the directional navigation input respective to the nav- property is ignored — there is no need to refocus the same element.

The <target-name> parameter indicates the target frame for the focus navigation. It is a string and it cannot start with the underscore "_" character. If the specified target frame does not exist, the parameter will be treated as the keyword ‘current’, which means to simply use the frame that the element is in. The keyword ‘root’ indicates that the user agent should target the full window.

User agents for devices with directional navigation keys respond by navigating the focus according to four respective nav-* directional navigation properties (nav-up, nav-right, nav-down, nav-left). This specification does not define which keys of a device are directional navigational keys.

Note. Typical personal computers have keyboards with four arrow keys. One possible implementation would be to use those four arrow keys for directional navigation. For accessibility and user convenience, user agents should allow configuration of which keys on a keyboard are used for directional navigation.

Example: positioned buttons

Here is an example of buttons positioned in a diamond shape whose navigation order and directional focus navigation is set in such a way to navigate the focus clockwise (or counter-clockwise) around the diamond shape when the user chooses to navigate sequentially or directionally.

button { position:absolute }

button#b1 {
	top:0; left:50%;
	nav-right:#b2; nav-left:#b4;
	nav-down:#b2; nav-up:#b4;

button#b2 {
	top:50%; left:100%;
	nav-right:#b3; nav-left:#b1;
	nav-down:#b3; nav-up:#b1;

button#b3 {
	top:100%; left:50%;
	nav-right:#b4; nav-left:#b2;
	nav-down:#b4; nav-up:#b2;
button#b4 {
	top:50%; left:0;
	nav-right:#b1; nav-left:#b3;
	nav-down:#b1; nav-up:#b3;

Whatever markup sequence the buttons may have (which is not specified in this example) is irrelevant in this case because they are positioned, and yet, it is still important to ensure focus navigation behaviors which relate reasonably to the specified layout.

Note: The ‘nav-up’, ‘nav-right’, ‘nav-down’, and ‘nav-left’ properties are at risk.

9.2.3. Input method editor: the ime-mode property

Name: ime-mode
Value: auto | normal | active | inactive | disabled | inherit
Initial: auto
Applies to: text fields
Inherited: no
Percentages: N/A
Media: interactive
Computed value: as specified

The ‘ime-mode’ CSS property controls the state of the input method editor for text fields.

No change is made to the current input method editor state. This is the default.
The IME state should be normal; this value can be used in a user style sheet to override the page setting.
The input method editor is initially active; text entry is performed using it unless the user specifically dismisses it.
The input method editor is initially inactive, but the user may activate it if they wish.
The input method editor is disabled and may not be activated by the user.
Example: disabling input method support
<input type="text" name="name" value="initial value" style="ime-mode: disabled">

This example disables input method support for a field; this might be necessary for fields that enter data into a database that doesn't support extended character sets, for example.

Example: user preference
input[type=password] {
    ime-mode: auto !important;

This example CSS may be placed into a user style sheet file to force password input fields to behave in a default manner.

Note: In general, it's not appropriate for a public web site to manipulate the IME mode setting. This property should be used for web applications and the like. Authors should not rely on disabling IME to prevent extended characters from passing through a form. Even with IME disabled, users can still paste extended characters into a form's fields.

Note: The ‘ime-mode’ property is at risk.

Appendix A. Acknowledgments

This appendix is informative.

Thanks to feedback and contributions from L. David Baron, Bert Bos, Matthew Brealey, Ada Chan, Michael Day, Micah Dubinko, Elika E., Steve Falkenburg, Al Gilman, Ian Hickson, Bjoern Hoehrmann, David Hyatt, Richard Ishida, Sho Kuwamoto, Susan Lesch, Peter Linss, Brad Pettit, Alexander Savenkov, Sebastian Schnitzenbaumer, Etan Wexler, David Woolley and Domel.

Appendix B. Bibiliography

Normative References

Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. W3C Recommendation. URL: http://www.w3.org/TR/2011/REC-CSS2-20110607
Tantek Çelik; Chris Lilley; L. David Baron. CSS Color Module Level 3. 7 June 2011. W3C Recommendation. URL: http://www.w3.org/TR/2011/REC-css3-color-20110607
T. Berners-Lee; L. Masinter; M. McCahill. Uniform Resource Locators (URL). December 1994. Internet RFC 1738. URL: http://www.ietf.org/rfc/rfc1738.txt
R. Fielding. Relative Uniform Resource Locators. June 1995. Internet RFC 1808. (Obsoleted by RFC 3986) URL: http://www.ietf.org/rfc/rfc1808.txt
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. Internet RFC 2119. URL: http://www.ietf.org/rfc/rfc2119.txt
Tantek Çelik; et al. Selectors Level 3. 29 September 2011. W3C Recommendation. URL: http://www.w3.org/TR/2011/REC-css3-selectors-20110929/
Mark Davis. Unicode Text Segmentation. 8 October 2010. Unicode Standard Annex #29. URL: http://www.unicode.org/reports/tr29/tr29-17.html
T. Berners-Lee; R. Fielding; L. Masinter. Uniform Resource Identifiers (URI): generic syntax. January 2005. Internet RFC 3986. URL: http://www.ietf.org/rfc/rfc3986.txt

Informative References

Håkon Wium Lie; Bert Bos. Cascading Style Sheets (CSS1) Level 1 Specification. 11 April 2008. W3C Recommendation. URL: http://www.w3.org/TR/2008/REC-CSS1-20080411
Ian Jacobs; et al. Cascading Style Sheets, level 2 (CSS2) Specification. 11 April 2008. W3C Recommendation. URL: http://www.w3.org/TR/2008/REC-CSS2-20080411
Ian Hickson. CSS3 Generated and Replaced Content Module. 14 May 2003. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/2003/WD-css3-content-20030514
Bert Bos. CSS Marquee Module Level 3. 5 December 2008. W3C Candidate Recommendation. (Work in progress.) URL: http://www.w3.org/TR/2008/CR-css3-marquee-20081205
Tantek Çelik. User Interface for CSS3. 16 February 2000. W3C Working Draft. (Superseded) URL: http://www.w3.org/TR/2002/WD-css3-userint-20020802
Dave Raggett; Arnaud Le Hors; Ian Jacobs. HTML 4.01 Specification. 24 December 1999. W3C Recommendation. URL: http://www.w3.org/TR/1999/REC-html401-19991224
Ian Hickson. HTML5. 25 May 2011. W3C Working Draft. (Work in progress.) URL: http://www.w3.org/TR/2011/WD-html5-20110525/
Jon Ferraiolo. Scalable Vector Graphics (SVG) 1.0 Specification. 4 September 2001. W3C Recommendation. URL: http://www.w3.org/TR/2001/REC-SVG-20010904
Erik Dahlström; et al. Scalable Vector Graphics (SVG) 1.1 (Second Edition). 16 August 2011. W3C Recommendation. URL: http://www.w3.org/TR/2011/REC-SVG11-20110816/
Ian Jacobs; Jon Gunderson; Eric Hansen. User Agent Accessibility Guidelines 1.0. 17 December 2002. W3C Recommendation. URL: http://www.w3.org/TR/2002/REC-UAAG10-20021217/
John M. Boyer. XForms 1.1. 18 August 2009. W3C Proposed Recommendation. (Work in progress.) URL: http://www.w3.org/TR/2009/PR-xforms11-20090818
Steven Pemberton. XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition). 1 August 2002. W3C Recommendation. URL: http://www.w3.org/TR/2002/REC-xhtml1-20020801
Murray Altheim; Shane McCarron. XHTML™ 1.1 - Module-based XHTML. 31 May 2001. W3C Recommendation. URL: http://www.w3.org/TR/2001/REC-xhtml11-20010531
C. M. Sperberg-McQueen; et al. Extensible Markup Language (XML) 1.0 (Fifth Edition). 26 November 2008. W3C Recommendation. URL: http://www.w3.org/TR/2008/REC-xml-20081126/

Appendix C. Changes

This appendix is informative.

In general this draft contains numerous editorial/grammatical/spelling corrections, and several new informative examples. This appendix describes minor functional changes from the Candidate Recommendation (CR) of 11 May 2004 that were made to reflect implementer adoption (or lack thereof) in the seven years since. In particular, changes since the CR fall into one of three categories:

List of substantial changes

Appendix D. Default style sheet additions for HTML

This appendix is informative.

Potential additions to the base style sheet to express HTML form controls, and a few dynamic presentation attributes:

:enabled:focus {
 outline: 2px inset;

 display: inline-block;
 white-space: nowrap;

/* white space handling of BUTTON tags in particular */

/* default content of HTML4/XHTML1 input type=reset button */
 content: "Reset";

/* default content of HTML4/XHTML1 input type=submit button */
 content: "Submit";

/* text content/labels of HTML4/XHTML1 "input" buttons */
 content: attr(value);

/* white space handling of TEXTAREA tags in particular */

/* appearance of the HTML4/XHTML1 hidden text field in particular */
 display: none;

 display: inline-block;
 content: attr(src,url);
 border: none;

/* HTML4/XHTML1 <select> w/ size more than 1 - appearance of list */
 display: inline-block;
 height: attr(size,em);

/* HTML4/XHTML1 <select> without size, or size=1 - popup-menu */
 display: inline-block;
 height: 1em;
 overflow: hidden;

/* active HTML4/XHTML <select> w/ size more than 1 - appearance of active list */
 display: inline-block;

 display: block;
 white-space: nowrap;

 content: attr(label);

 display: inline;
 content: check; 

*[tabindex] { nav-index:attr(tabindex,number) }

/* Though FRAME resizing is not directly addressed by this specification,
   the following rules may provide an approximation of reasonable behavior. */


frame { resize:both }
frame[noresize] { resize:none }


Appendix E: Test Suite

This appendix is informative.

This specification shall refer to a test suite written according to the CSS Test Suite Documentation and following the CSS2.1 Test Case Authoring Guidelines. The test suite shall allow user agents to verify their basic conformance to the specification. This test suite does not pretend to be exhaustive and does not cover all possible combinations of user interface related features. These tests will be made available from the CSS Test Suites home page.

Related issue: 1.


This appendix is informative.

Property index

This appendix is informative.

Property Values Initial Applies to Inh. Percentages Media
box-sizing content-box | padding-box | border-box | inherit content-box all elements that accept width or height no N/A visual
content icon same as CSS 2.1 same as CSS 2.1 same as CSS 2.1 same as CSS 2.1 same as CSS 2.1
cursor [ [<uri> [<x> <y>]?,]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out ] ] | inherit auto all elements yes N/A visual, interactive
icon auto | <uri> [, <uri>]* | inherit auto all elements no N/A all
ime-mode auto | normal | active | inactive | disabled | inherit auto text fields no N/A interactive
nav-index auto | <number> | inherit auto all enabled elements no n/a interactive
nav-up, nav-right, nav-down, nav-left auto | <id> [ current | root | <target-name> ]? | inherit auto all enabled elements no N/A interactive
outline [ <‘outline-color’> || <‘outline-style’> || <‘outline-width’> ] | inherit see individual properties all elements no N/A visual
outline-color <color> | invert | inherit invert all elements no N/A visual
outline-offset <length> | inherit 0 all elements no N/A visual
outline-style auto | <border-style> | inherit none all elements no N/A visual
outline-width <border-width> | inherit medium all elements no N/A visual
resize none | both | horizontal | vertical | inherit none elements with ‘overflow’ other than visible no N/A visual
text-overflow ( clip | ellipsis | <string> ){1,2} | inherit clip block containers no N/A visual