Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1632 lines (1358 sloc) 61.3 KB
<style>
dt[style*="cursor"] * { cursor: inherit; }
</style>
<style>
.awesome-table td {padding:5px}
.awesome-table {color:#000;background:#fff;margin: auto;}
</style>
<pre class='metadata'>
Title: CSS Basic User Interface Module Level 3 (CSS3 UI)
ED: https://drafts.csswg.org/css-ui/
TR: https://www.w3.org/TR/css3-ui/
Previous Version: https://www.w3.org/TR/2017/PR-css-ui-3-20171214/
Shortname: css-ui
Level: 3
Group: csswg
Status: REC
Prepare for TR: true
Work Status: completed
Editor: Tantek Çelik, Mozilla https://www.mozilla.org/, tantek@cs.stanford.edu, http://tantek.com, w3cid 1464
Editor: Florian Rivoal, On behalf of Bloomberg, http://florian.rivoal.net/, w3cid 43241
Abstract: This specification describes user interface related
properties and values that are proposed for CSS level&nbsp;3
to style HTML and XML (including XHTML).
It includes and extends user interface related features from the
properties and values of CSS level&nbsp;2 revision 1.
It uses various
properties and values to style basic user interface elements in a document.
Link Defaults: css-color-3 (property) color
Link Defaults: css2 (property) min-width
Link Defaults: css2 (property) min-height
Link Defaults: css2 (property) max-width
Link Defaults: css2 (property) max-height
Link Defaults: css2 (property) width
Link Defaults: css2 (property) height
Link Defaults: css2 (property) margin-left
Link Defaults: css2 (property) margin-top
Link Defaults: css2 (property) padding-bottom
Link Defaults: css2 (property) padding-left
Link Defaults: css2 (property) padding-right
Link Defaults: css2 (property) padding-top
Link Defaults: css2 (property) visibility
Link Defaults: css-writing-modes-3 (dfn) start
Link Defaults: css-writing-modes-3 (dfn) end
Ignored Terms: outline-top
Ignored Terms: outline-left
Ignored Terms: ime-mode
Can I Use URL: https://drafts.csswg.org/css-ui-3/
Can I Use URL: http://drafts.csswg.org/css-ui-3/
Can I Use URL: https://drafts.csswg.org/css-ui/
Can I Use URL: http://drafts.csswg.org/css-ui/
Can I Use URL: https://www.w3.org/TR/css-ui-3/
Can I Use URL: http://www.w3.org/TR/css-ui-3/
Can I Use URL: https://www.w3.org/TR/css3-ui/
Can I Use URL: http://www.w3.org/TR/css3-ui/
Ignore Can I Use URL Failure: https://drafts.csswg.org/css-ui-3/
Ignore Can I Use URL Failure: http://drafts.csswg.org/css-ui-3/
Ignore Can I Use URL Failure: https://drafts.csswg.org/css-ui/
Ignore Can I Use URL Failure: http://drafts.csswg.org/css-ui/
Ignore Can I Use URL Failure: https://www.w3.org/TR/css-ui-3/
Ignore Can I Use URL Failure: http://www.w3.org/TR/css-ui-3/
Ignore Can I Use URL Failure: https://www.w3.org/TR/css3-ui/
Ignore Can I Use URL Failure: http://www.w3.org/TR/css3-ui/
</pre>
<pre class=link-defaults>
spec:css-overflow-3; type:property; text:overflow
spec:css2; type:property; text:display
spec:css2; type:property; text:width
spec:css2; type:property; text:height
spec:css2; type:property; text:left
spec:css2; type:property; text:overflow
spec:css2; type:property; text:border-bottom-width
spec:css2; type:property; text:border-left-width
spec:css2; type:property; text:border-right-width
spec:css2; type:property; text:border-top-width
spec:css2; type:property; text:border-style
spec:css2; type:property; text:border-width
spec:css2; type:property; text:background-image
</pre>
<!-- Some of the following definitions have existing exported defintions from other specs,
but not from specs that are OK to link to from a CR -->
<pre class="anchors">
url: https://www.w3.org/TR/CSS2/box.html#border-edge; type: dfn; spec: CSS2; text: border edge
url: https://www.w3.org/TR/CSS2/visufx.html#propdef-overflow
type: property; spec: CSS2; text: overflow
type: value; spec: CSS2; text: visible; for: overflow
url: https://www.w3.org/TR/CSS2/visuren.html#position-props; type: property; spec: CSS2;
text: top
text: bottom
text: left
text: right
url: https://www.w3.org/TR/CSS2/visudet.html#the-width-property; type: value; spec: CSS2; for: width; text: auto
</pre>
<h2 id="intro">Introduction</h2>
This module describes CSS properties which enable authors
to style user interface related properties and values.
<a href="https://www.w3.org/TR/REC-CSS1#anchor-pseudo-classes">Section 2.1 of CSS1</a> [[CSS1]]
and <a href="https://www.w3.org/TR/CSS2/ui.html">Chapter 18 of CSS2</a> [[CSS2]]
introduced several user interface related properties and values.
<a href="https://www.w3.org/TR/2000/WD-css3-userint-20000216">User Interface for CSS3 (16 February 2000)</a> introduced several new user interface related features.
This specification incorporates, extends, and supersedes them.
<h3 id="purpose">Purpose</h3>
The purpose of this specification is to achieve the following objectives:
<ul>
<li>Extend the user interface features in CSS2.1.
<li>Provide additional CSS mechanisms to augment or replace other
dynamic presentation related features in HTML.
</ul>
<h2 id="interaction">Module Interactions</h2>
This document defines new features not present in earlier specifications.
In addition, it replaces and supersedes the following:
<ul>
<li><a href="https://www.w3.org/TR/CSS2/ui.html#cursor-props">Section 18.1</a>,
<a href="https://www.w3.org/TR/CSS2/ui.html#dynamic-outlines">section 18.4</a>,
and Information on the stacking of outlines defined in
<a href="https://www.w3.org/TR/CSS2/zindex.html">Appendix E</a>
of Cascading Style Sheets, level 2, revision 1 [[CSS2]]
<li><a href="https://www.w3.org/TR/2000/WD-css3-userint-20000216">User Interface for CSS3 (16 February 2000)</a>
</ul>
Note: The semantics of property definition tables were first introduced in [[CSS2#property-defs]].
More up-to-date definitions can be found in
[[css-transitions-1]],
[[css-values-3]],
and [[css-cascade-4]].
For the reader's convenience,
this specification links directly to these terms where relevant.
<h2 id="box-model">Box Model addition</h2>
<h3 id="box-sizing" caniuse="css3-boxsizing">Changing the Box Model: the 'box-sizing' property</h3>
<pre class="propdef">
Name: box-sizing
Value: content-box | border-box
Initial: content-box
Applies to: all elements that accept width or height
Inherited: no
Percentages: N/A
Computed value: specified value
Animation type: discrete
</pre>
<dl dfn-type=value dfn-for=box-sizing>
<dt><dfn>content-box</dfn></dt>
<dd>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.</dd>
<dt><dfn>border-box</dfn></dt>
<dd>Length and percentages values for 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
<a href="https://www.w3.org/TR/CSS2/visudet.html#the-width-property">cannot be negative</a> ([[!CSS2]], section 10.2),
this computation is floored at 0.
Used values, as exposed for instance through getComputedStyle(), also refer to the border box.
Note: This is the behavior of width and height as commonly implemented
by legacy HTML user agents for replaced elements and input elements.
</dd>
</dl>
Note: In contrast to the length and percentage values,
the ''width/auto'' value of the 'width' and 'height' properties
(as well as other keyword values introduced by later specifications,
unless otherwise specified)
is not influenced by the 'box-sizing' property,
and always sets the size of the content box.
The following terms, whose definitions vary based on the computed value of 'box-sizing' are introduced:
<table class="data">
<thead>
<tr><th><th>''box-sizing: content-box''<th>''box-sizing: border-box''
<tbody>
<tr><th><dfn>min inner width</dfn><td>'min-width'<td>max(0, 'min-width' &minus; 'padding-left' &minus; 'padding-right' &minus; 'border-left-width' &minus; 'border-right-width')
<tr><th><dfn>max inner width</dfn><td>'max-width'<td>max(0, 'max-width' &minus; 'padding-left' &minus; 'padding-right' &minus; 'border-left-width' &minus; 'border-right-width')
<tr><th><dfn>min inner height</dfn><td>'min-height'<td>max(0, 'min-height' &minus; 'padding-top' &minus; 'padding-bottom' &minus; 'border-top-width' &minus; 'border-bottom-width')
<tr><th><dfn>max inner height</dfn><td>'max-height'<td>max(0, 'max-height' &minus; 'padding-top' &minus; 'padding-bottom' &minus; 'border-top-width' &minus; 'border-bottom-width')
</table>
The <a href="https://www.w3.org/TR/CSS2/visudet.html">Visual formatting model details</a> of [[!CSS2]] are written assuming ''box-sizing: content-box''. The following disambiguations are made to clarify the behavior for all values of 'box-sizing':
<ol>
<li>In <a href="https://www.w3.org/TR/CSS2/visudet.html#blockwidth">10.3.3</a>, the second <q>width</q> in the following phrase is to be interpreted as <a spec="css2">content width</a>: <q>If 'width' is not ''width/auto'' and 'border-left-width' + 'padding-left' + 'width' + [...]</q>
<li>In <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width">10.3.7</a>, <q>width</q> is to be interpreted as <a spec="css2">content width</a> in the following equation: <q>'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + [...]</q>
<li>In <a href="https://www.w3.org/TR/CSS2/visudet.html#min-max-widths">10.4</a>, <q>width</q>, <q>height</q>, <q>min-width</q>, <q>max-width</q>, <q>min-height</q> and <q>max-height</q> are respectively to be interpreted as <a spec="css2">content width</a>, <a spec="css2">content height</a>, <a>min inner width</a>, <a>max inner width</a>, <a>min inner height</a> and <a>max inner height</a> in the following phrases:
<ol>
<li><q>The tentative used width is calculated [...]</q>
<li><q>If the tentative used width is greater than 'max-width', the rules above are applied again, but this time using the computed value of 'max-width' as the computed value for 'width'.</q>
<li><q>If the resulting width is smaller than 'min-width', the rules above are applied again, but this time using the value of 'min-width' as the computed value for 'width'.</q>
<li><q>Select from the table the resolved height and width values for the appropriate constraint violation. Take the max-width and max-height as max(min, max) so that min ≤ max holds true. In this table w and h stand for the results of the width and height computations [...]</q>
<li>All instances of these words in the table
<li><q>Then apply the rules under "Calculating widths and margins" above, as if 'width' were computed as this value.</q>
</ol>
<li>In <a href="https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height">10.6.4</a>, <q>height</q> is to be interpreted as <a spec="css2">content height</a> in the following equation: <q>'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + [...]</q>
<li>In <a href="https://www.w3.org/TR/CSS2/visudet.html#min-max-heights">10.7</a>, <q>width</q>, <q>height</q>, <q>min-height</q> and <q>max-height</q> are respectively to be interpreted as <a spec="css2">content width</a>, <a spec="css2">content height</a>, <a>min inner height</a> and <a>max inner height</a> in the following phrases:
<ol>
<li><q>The tentative used height is calculated [...]</q>
<li><q>If this tentative height is greater than 'max-height', the rules above are applied again, but this time using the value of 'max-height' as the computed value for 'height'.</q>
<li><q>If the resulting height is smaller than 'min-height', the rules above are applied again, but this time using the value of 'min-height' as the computed value for 'height'.</q>
<li><q>[...] use the algorithm under Minimum and maximum widths above to find the used width and height. Then apply the rules under "Computing heights and margins" above, using the resulting width and height as if they were the computed values.</q>
</ol>
</ol>
<div class="example"><p style="display:none">Example(s):
<h4 id="box-sizing-example" class="no-num no-toc">Using box-sizing to evenly share space</h4>
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:
<pre><code class="lang-css">
div.container {
width:38em;
border:1em solid black;
}
div.split {
box-sizing:border-box;
width:50%;
border:1em silver ridge;
float:left;
}
</code></pre>
sample HTML fragment:
<pre><code class="lang-markup">
&lt;div class="container"&gt;
&lt;div class="split"&gt;This div occupies the left half.&lt;/div&gt;
&lt;div class="split"&gt;This div occupies the right half.&lt;/div&gt;
&lt;/div&gt;
</code></pre>
demonstration of sample CSS and HTML:
<div style="width:38em; border:1em solid black"><div style="box-sizing:border-box; width:50%; border:1em silver ridge; float:left">This div should occupy the left half.</div><div style="box-sizing:border-box; width:50%; border:1em silver ridge; float:left">This div should occupy the right half.</div>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'.
</div>
</div>
<h2 id="outline-props" caniuse="outline">Outline properties</h2>
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:
<ol>
<li>Outlines do not take up space.
<li>Outlines may be non-rectangular.
<li>UAs often render outlines on elements in the :focus state.
</ol>
The outline properties control the style of these dynamic outlines.
The stacking of the rendering of these outlines is explicitly left up to implementations to provide a better user experience per platform. This supersedes the stacking of outlines as defined in <a href="https://www.w3.org/TR/CSS2/zindex.html">Appendix E of CSS 2.1</a> [[CSS2]].
<strong class="advisement">
Keyboard users,
in particular people with disabilities
who may not be able to interact with the page in any other fashion,
depend on the outline being visible
on elements in the :focus state,
thus authors must not make the outline invisible on such elements
without making sure an alternative highlighting mechanism is provided.
</strong>
The rendering of applying transforms to outlines is left explicitly undefined in CSS3-UI.
<h3 id="outline">Outlines Shorthand: the 'outline' property</h3>
<pre class="propdef shorthand">
Name: outline
Value: [ <<'outline-color'>> || <<'outline-style'>> || <<'outline-width'>> ]
Applies to: all elements
Inherited: no
Percentages: N/A
</pre>
<h3 id="outline-width">Outline Thickness: the 'outline-width' property</h3>
<pre class="propdef">
Name: outline-width
Value: <<line-width>>
Initial: medium
Applies to: all elements
Inherited: no
Percentages: N/A
Computed value: absolute length; ''0'' if the outline style is ''border-style/none''.
Animation type: by computed value
</pre>
<h3 id="outline-style">Outline Patterns: the 'outline-style' property</h3>
<pre class="propdef">
Name: outline-style
Value: auto | <'border-style'>
Initial: none
Applies to: all elements
Inherited: no
Percentages: N/A
Computed value: as specified
Animation type: discrete
</pre>
<h3 id="outline-color">Outline Colors: the 'outline-color' property</h3>
<pre class="propdef">
Name: outline-color
Value: <<color>> | invert
Initial: invert
Applies to: all elements
Inherited: no
Percentages: N/A
Computed value: The computed value for ''outline-color/invert'' is ''outline-color/invert'';
the computed value of ''outline-color/currentColor'' is ''outline-color/currentColor'' (See [[CSS-COLOR-3/#currentColor]]);
see the 'color' property for other <<color>> values.
Animation Type: by computed value
</pre>
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.
To the extent that the outline follows the <a>border edge</a>,
it should follow the 'border-radius' curve.
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.
Note: This specification does not define the exact position or shape of the outline, but it is typically drawn immediately outside the border box.
The 'outline-width' property accepts
the same values as
'border-width'
([[css-backgrounds-3#the-border-width]]).
The 'outline-style' property accepts
the same values as
'border-style'
([[css-backgrounds-3#the-border-style]]),
except that
<span class=css>hidden</span> is not a legal outline style.
In addition, in CSS3,
'outline-style'
accepts the value ''outline-style/auto''.
The ''outline-style/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
''outline-style/auto'' style outlines.
User agents may treat ''outline-style/auto'' as
''outline-style/solid''.
The 'outline-color' property
accepts all colors, as well as the keyword <dfn dfn-type=value for=outline-color>invert</dfn>.
''outline-color/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 ''outline-color/invert'' value
on platforms that do not support color inversion of the pixels on the screen.
If the UA does not support the ''outline-color/invert'' value
then it must reject that value at parse-time, and
the initial value of the 'outline-color' property
is the ''outline-color/currentColor'' 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.
<div class="example"><p style="display:none">Example(s):
Here's an example of drawing a thick outline around a BUTTON element:
<pre><code class="lang-css">
button { outline: thick solid }
</code></pre>
</div>
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 or selecting a button).
<div class="example"><p style="display:none">Example(s):
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:
<pre><code class="lang-css">
:focus { outline: thick solid black }
:active { outline: thick solid red }
</code></pre>
</div>
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.
<h3 id="outline-offset">Offsetting the Outline: the 'outline-offset' property</h3>
By default, the outline is drawn starting just outside the <a>border edge</a>.
However, it is possible to offset the outline and draw it beyond the <a>border edge</a>.
<pre class="propdef">
Name: outline-offset
Value: <<length>>
Initial: 0
Applies to: all elements
Inherited: no
Percentages: N/A
Computed value: absolute length
Animation type: by computed value
</pre>
If the computed value of 'outline-offset'
is anything other than 0,
then the outline is outset from the <a>border edge</a> by that amount.
<div class="example"><p style="display:none">Example(s):
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:
<pre><code class="lang-css">
:focus,:active { outline-offset: 2px }
</code></pre>
</div>
<p id=negative-offset>Negative values must cause the outline
to shrink into the border box.
Both the height and the width of outside of the shape
drawn by the outline should not become smaller
than twice the computed value of the 'outline-width' property,
to make sure that an outline can be rendered
even with large negative values.
User Agents should apply this constraint
independently in each dimension.
If the outline is drawn as multiple disconnected shapes,
this constraint applies to each shape separately.
<h2 id="resizing-and-overflow">Resizing &amp; Overflow</h2>
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.
<h3 id="resize" caniuse="css-resize">Resizing Boxes: the 'resize' property</h3>
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.
<pre class="propdef">
Name: resize
Value: none | both | horizontal | vertical
Initial: none
Applies to: elements with 'overflow' other than visible,
and optionally replaced elements such as images, videos, and iframes
Inherited: no
Percentages: N/A
Computed value: specified keyword
Animation type: discrete
</pre>
<dl>
<dt>none</dt>
<dd>The UA does not present a resizing mechanism on the element,
and the user is given no direct manipulation mechanism to resize the element.</dd>
<dt>both</dt>
<dd>The UA presents a bidirectional resizing mechanism
to allow the user to adjust both the height and the width of the element.</dd>
<dt>horizontal</dt>
<dd>The UA presents a unidirectional horizontal resizing mechanism
to allow the user to adjust only the width of the element.</dd>
<dt>vertical</dt>
<dd>The UA presents a unidirectional vertical resizing mechanism
to allow the user to adjust only the height of the element.</dd>
</dl>
Currently it is possible to control the appearance of the scrolling mechanism (if any)
on an element using the 'overflow' property
(e.g. <code class="lang-css">overflow: scroll</code> vs. <code class="lang-css">overflow: hidden</code> etc.).
The purpose of the 'resize' property
is to 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,
nor is it related to any UA mechanism for zooming.
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''.
UAs may also apply it,
regardless of the value of the 'overflow' property,
to:
<ul>
<li>Replaced elements representing images or videos, such as <{img}>, <{video}>, <{picture}>, <{svg}>, <{object}>, or <{canvas}>.
<li>The <{iframe}> element.
</ul>
The effect of the 'resize' property on generated content is undefined. Implementations should not apply the 'resize' property to generated content.
Note: the 'resize' property may apply to generated content in the future if there is implementation of <a href="https://drafts.csswg.org/css-pseudo/#CSSPseudoElement-interface">Interface CSSPseudoElement</a> (See [[css-pseudo-4]]).
When an element is resized by the user,
the user agent sets
the 'width' and 'height' properties
to px unit length values of the size indicated by the user,
in the element’s <a href="https://www.w3.org/TR/css-style-attr/#style-attribute">style attribute</a> DOM,
replacing existing property declaration(s), if any,
without ''!important'', if any.
If an element is resized in only one dimension,
only the corresponding property is set, not both.
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 CSS layout 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 UA should consider the direction of resizing
(as determined by CSS layout),
as well as platform conventions and constraints when deciding
how to convey the resizing mechanism to the user.
The user agent must allow the user to resize the element
with no other constraints than what is imposed by
'min-width', 'max-width', 'min-height', and 'max-height'.
Note: There may be situations where user attempts to resize an element
appear to be overriden or ignored, e.g. because of ''!important'' cascading declarations that supersede
that element’s <a href="https://www.w3.org/TR/css-style-attr/#style-attribute">style attribute</a>
'width' and 'height' properties in the DOM.
Changes to the computed value of an element's 'resize' property
do not reset changes to the <a href="https://www.w3.org/TR/css-style-attr/#style-attribute">style attribute</a> made due to
user resizing of that element.
<div class="example"><p style="display:none">Example(s):
For example,
to make iframes scrollable <em>and</em> resizable,
the following rule can be used:
<pre><code class="lang-css">
iframe,object[type^="text/"],
object[type$="+xml"],object[type="application/xml"]
{
overflow:auto;
resize:both;
}
</code></pre>
</div>
<!--
too bad we don't have @viewport yet. otherwise this would be cool:
<pre><code class="lang-css">
@viewport {
width: 100px;
height: 100px;
overflow: hidden;
resize: none
} /* display content in a non-resizable 100px by 100px window */
</code></pre>
-->
<h3 id="text-overflow" caniuse="text-overflow">
Overflow Ellipsis: the 'text-overflow' property</h3>
<pre class="propdef">
Name: text-overflow
Value: clip | ellipsis
Initial: clip
Applies to: block containers
Inherited: no
Percentages: N/A
Computed value: specified keyword
Animation type: discrete
</pre>
This property specifies rendering when inline content overflows
its <a>end</a> line box edge
in the inline progression direction of its block container element ("the block")
that has 'overflow'
other than ''visible''.
Text can overflow for example when it is prevented from wrapping
(e.g. due to <code class="lang-css">white-space: nowrap</code>
or a single word is too long to fit).
Values have the following meanings:
<dl data-dfn-for="text-overflow" class="valuedef">
<dt><dfn id=overflow-clip dfn-type=value>clip</dfn></dt>
<dd>Clip inline content that overflows its block container element. Characters may be only partially rendered.</dd>
<dt><dfn id=overflow-ellipsis dfn-type=value>ellipsis</dfn></dt>
<dd>
Render an ellipsis character (U+2026)
to represent clipped inline content.
Implementations may substitute a more language, script, or writing-mode appropriate
ellipsis character,
or three dots "..." if the ellipsis character is unavailable.
</dd>
</dl>
The term "character" is used in this property definition
for better readability and means "grapheme cluster" [[!UAX29]]
for implementation purposes.
For the ellipsis value
implementations must hide characters and
<a href="https://www.w3.org/TR/CSS2/visuren.html#inline-boxes">
atomic inline-level elements</a>
at the <a>end</a> edge of the line as necessary to fit the ellipsis, and
place the ellipsis immediately adjacent
to the <a>end</a> edge of the remaining inline content.
The first character or
<a href="https://www.w3.org/TR/CSS2/visuren.html#inline-boxes">
atomic inline-level element</a>
on a line
must be clipped rather than ellipsed.
<div class=example>
<h4 id="bidi-ellipsis" class="no-num no-toc">Bidi ellipsis examples</h4>
These examples demonstrate which characters get hidden
to make room for the ellipsis in a bidi situation:
those visually at the end edge of the line.
Sample CSS:
<pre><code highlight=css>
div {
font-family: monospace;
white-space: pre;
overflow: hidden;
width: 9ch;
text-overflow: ellipsis;
}
</code></pre>
Sample HTML fragments, renderings, and your browser:
<table class="awesome-table data">
<thead><th>HTML<th>Reference rendering<th>Your Browser</thead>
<tr>
<td><code highlight=html>&ltdiv>שלום 123456&lt;/div></code><td><div style="font-family:monospace">123456 ם…</div><td><div style="font-family: monospace; white-space: pre; overflow: hidden; width: 9ch; text-overflow: ellipsis">שלום 123456</div>
<tr><td><code highlight=html>&ltdiv dir=rtl>שלום 123456&lt;/div></code><td><div style="font-family:monospace">…456 שלום</div><td><div style="font-family: monospace; white-space: pre; overflow: hidden; width: 9ch; text-overflow: ellipsis" dir=rtl>שלום 123456</div>
</table>
</div>
<h4 id="ellipsing-details" class="no-num no-toc">ellipsing details</h4>
<ul>
<li>
Ellipsing only affects rendering and must not affect layout
nor dispatching of pointer events:
The UA should dispatch any pointer event on the ellipsis to the elided element,
as if 'text-overflow' had been ''text-overflow/none''.
<li>
The ellipsis is styled and baseline-aligned according to
the block.
<li>
Ellipsing occurs after relative positioning and other graphical transformations.
<li>
If there is insufficient space for the ellipsis,
then clip the rendering of the ellipsis itself
(on the same side that neutral characters on the line
would have otherwise been clipped with the ''text-overflow:clip'' value).
</ul>
<h4 id="ellipsis-interaction" class="no-num no-toc">user interaction with ellipsis</h4>
<ul>
<li>When the user is interacting with content
(e.g. editing, selecting, scrolling),
the user agent may treat ''text-overflow: ellipsis'' as ''text-overflow: clip''.
<li>Selecting the ellipsis should select the ellipsed text.
If all of the ellipsed text is selected,
UAs should show selection of the ellipsis.
Behavior of partially-selected ellipsed text is up to the UA.
</ul>
<div class="example"><p style="display:none">Example(s):
<h4 id="text-overflow-examples" class="no-num no-toc">text-overflow examples</h4>
These examples demonstrate setting the text-overflow of a block container element
that has text which overflows its dimensions:
sample CSS for a div:
<pre><code class="lang-css">div {
font-family:Helvetica,sans-serif; line-height:1.1;
width:3.1em; padding:.2em; border:solid .1em black; margin:1em 0;
}</code></pre>
sample HTML fragments, renderings, and your browser:
<table class="awesome-table"><tbody>
<tr><th>HTML</th><th>sample rendering</th><th>your browser</th></tr>
<tr>
<td><pre><code class="lang-markup">&lt;div&gt;
CSS IS AWESOME, YES
&lt;/div&gt;
</code></pre></td>
<td>
<object type="image/png" data="images/cssisawesome.png">
First, a box with text drawing outside of it.
</object>
</td>
<td>
<div style="width:3.1em; border:solid .1em black; margin:1em 0; padding:.2em; font-family:Helvetica,sans-serif; line-height:1.1;">CSS IS AWESOME, YES</div>
</td>
</tr>
<tr>
<td><pre><code class="lang-markup">&lt;div style="<strong>text-overflow:clip;</strong> overflow:hidden"&gt;
CSS IS AWESOME, YES
&lt;/div&gt;
</code></pre></td>
<td>
<object type="image/png" data="images/cssisaweso.png">
Second, a similar box with the text clipped outside the box.
</object></td>
<td>
<div style="width:3.1em; border:solid .1em black; margin:1em 0; padding:.2em; font-family:Helvetica,sans-serif; line-height:1.1; overflow:hidden;text-overflow:clip;">CSS IS AWESOME, YES</div>
</td>
</tr>
<tr>
<td><pre><code class="lang-markup">&lt;div style="<strong>text-overflow:ellipsis;</strong> overflow:hidden"&gt;
CSS IS AWESOME, YES
&lt;/div&gt;
</code></pre></td>
<td>
<object type="image/png" data="images/cssisaw.png">
Third, a similar box with an ellipsis representing the clipped text.
</object>
</td>
<td>
<div style="width:3.1em; border:solid .1em black; margin:1em 0; padding:.2em; font-family:Helvetica,sans-serif; line-height:1.1; overflow:hidden;text-overflow:ellipsis;">CSS IS AWESOME, YES</div>
</td>
</tr>
<tr>
<td><pre><code class="lang-markup">&lt;div style="<strong>text-overflow:ellipsis;</strong> overflow:hidden"&gt;
NESTED
&lt;p&gt;PARAGRAPH&lt;/p&gt;
WON'T ELLIPSE.
&lt;/div&gt;
</code></pre></td>
<td>
<object type="image/png" data="images/nes.png">
Fourth, a box with a nested paragraph demonstrating anonymous block boxes equivalency and non-inheritance into a nested element.
</object>
</td>
<td>
<div style="width:3.1em; border:solid .1em black; margin:1em 0; padding:.2em; font-family:Helvetica,sans-serif; line-height:1.1; overflow:hidden;text-overflow:ellipsis;">NESTED
<p>PARAGRAPH</p>
WON'T ELLIPSE.</div>
</td>
</tr>
</tbody></table>
</div>
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
(<code class="lang-css">direction: rtl</code>)
block clips inline content on the <a spec=css-writing-modes-3>left</a> side,
thus would place a text-overflow ellipsis on the <a spec=css-writing-modes-3>left</a>
to represent that clipped content.
<!-- insert RTL example diagram here to illustrate note. -->
<h4 id="ellipsis-scrolling" class="no-num no-toc">ellipsis interaction with scrolling interfaces</h4>
This section applies to elements with text-overflow other than ''text-overflow: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),
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.
<div class="example"><p style="display:none">Example(s):
This example uses text-overflow on an element with overflow scroll
to demonstrate the above described behavior.
sample CSS:
<pre><code class="lang-css">
div.crawlbar {
text-overflow: ellipsis;
height: 2em;
overflow: scroll;
white-space: nowrap;
width: 15em;
border:1em solid black;
}
</code></pre>
sample HTML fragment:
<pre><code class="lang-markup">
&lt;div class="crawlbar"&gt;
CSS is awesome, especially when you can scroll
to see extra text instead of just
having it overlap other text by default.
&lt;/div&gt;
</code></pre>
demonstration of sample CSS and HTML:
<div style="text-overflow: ellipsis; height: 2em; overflow: scroll; white-space: nowrap; width: 15em; border:1em solid black;">
CSS is awesome, especially when you can scroll
to see extra text instead of just
having it overlap other text by default.
</div>
</div> <!-- example -->
While the content is being scrolled, implementations may adjust their rendering of ellipses (e.g. align to the box edge rather than line edge).
<h2 id="pointing-keyboard">Pointing Devices and Keyboards</h2>
<h3 id="pointer-interaction">Pointer interaction</h3>
<h4 id="cursor" caniuse="css3-cursors">Styling the Cursor: the 'cursor' property</h4>
<pre class="propdef">
Name: cursor
Value: [ [<<url>> [&lt;x&gt; &lt;y&gt;]?,]* <br>
[ auto | default | none |<br>
context-menu | help | pointer | progress | wait | <br>
cell | crosshair | text | vertical-text | <br>
alias | copy | move | no-drop | not-allowed | grab | grabbing | <br>
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 |<br>
zoom-in | zoom-out <br>
] ]
Initial: auto
Applies to: all elements
Inherited: yes
Percentages: N/A
Computed value: as specified, except with any relative URLs converted to absolute
Animation type: discrete
</pre>
This property specifies the type of cursor to be displayed for the pointing device
when the cursor's hotspot is within the element's <a>border edge</a>.
Note: As per [[css-backgrounds-3#the-border-radius]], the <a>border edge</a> is affected by 'border-radius'.
In the case of overlapping elements,
which element determines the type of cursor
is based on hit testing:
the element determining the cursor
is the one that would receive a click
initiated from this position.
Note: The specifics of hit testing
are out of scope of this specification.
Hit testing will hopefully be defined
in a future revision of CSS or HTML.
User agents may ignore the cursor property over native user-agent controls such as scrollbars, resizers, or other native UI widgets e.g. those that may be used inside some user agent specific implementations of form elements.
User agents may also ignore the cursor property
and display a cursor of their choice
to indicate various states of the UA's user interface,
such as a busy cursor when the page is not responding,
or a text cursor when the user is performing text selection.
Note: [[HTML]] defines <a href="https://html.spec.whatwg.org/multipage/rendering.html#image-maps-2">special handling of image maps</a>
for the 'cursor' property.
Values have the following meanings:
<style>
#cursors dfn { cursor: inherit }
</style>
<dl dfn-type=value dfn-for=cursor id=cursors>
<dt>image cursors
<dd>
<dl>
<dt><<url>></dt>
<dd>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.
Conforming User Agents may, instead of <<url>>, support <<image>> which is a superset.
The UA must support the following image file formats:
<ul>
<li>PNG, as defined in [[!PNG]]
<li>SVG, as defined in [[!SVG11]], in <a href="https://www.w3.org/TR/SVG2/conform.html#secure-static-mode">secure static mode</a> [[!SVG2]], if it has an intrinsic size.
<li>any other non-animated image file format that they support
for <<image>> in other properties,
such as the the 'background-image' property
</ul>
In addition, the UA should support the following image file formats:
<ul>
<li>SVG, as defined in [[!SVG11]], in <a href="https://www.w3.org/TR/SVG2/conform.html#secure-animated-mode">secure animated mode</a> [[!SVG2]], if it has an intrinsic size.
<li>any other animated image file format that they support
for <<image>> in other properties,
such as the the 'background-image' property
</ul>
The UA may also support additional file formats, including SVG, as defined in [[!SVG11]], in secure static mode or secure animated mode [[!SVG2]], even if it does not have an intrinsic size.
Note: The CSS Working group initially intended support for all SVG,
intrinsically sized or not.
Support for non intrinsically sized SVG was downgraded from mandatory to optional due
to lack of implementations.
Note: At the time of writing this specification (spring 2015),
the only file formats supported for cursors in common desktop browsers are
the .ico and .cur file formats, as designed by Microsoft.
For compatibility with legacy content,
UAs are encouraged to support these,
even though the lack of an open specification
makes it impossible to have a normative requirement
about these formats.
Some information on these formats can be found
<a href="https://en.wikipedia.org/wiki/ICO_%28file_format%29">on Wikipedia</a>.
The <a>default object size</a> for cursor images is
a UA-defined size that should be based on
the size of a typical cursor on the UA's operating system.
The <a>concrete object size</a> is determined using
the <a>default sizing algorithm</a>.
If an operating system is
<strong>incapable</strong> of rendering a cursor above a given size,
cursors larger than that size must be shrunk to within
the OS-supported size bounds,
while maintaining the cursor image's intrinsic ratio, if any.
The optional &lt;x&gt; and &lt;y&gt; coordinates
identify the exact position within the image which is the pointer position (i.e., the hotspot).
</dd>
<dt>&lt;x&gt;</dt>
<dt>&lt;y&gt;</dt>
<dd>
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.
Note: This specification does not define
how the coordinate systems of the various types of <<image>> are established,
and defers these definitions to [[CSS4-IMAGES]].
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.
If the coordinates of the hotspot,
as specified either inside the image resource or
by &lt;x&gt; and &lt;y&gt; values,
fall outside of the cursor image,
they must be clamped (independently) to fit.
</dd>
</dl>
<dt>general purpose cursors
<dd>
<dl>
<dt style="cursor:auto"><dfn>auto</dfn></dt>
<dd>The UA determines the cursor to display based on the current
context, specifically: auto behaves as ''cursor/text'' over selectable text or editable elements, and ''cursor/default'' otherwise.
</dd>
<dt style="cursor:default"><dfn>default</dfn></dt>
<dd>The platform-dependent default cursor. Often rendered as an arrow.
</dd>
<dt style="cursor:none"><dfn>none</dfn></dt>
<dd>No cursor is rendered for the element.</dd>
</dl>
<dt>links and status cursors
<dd>
<dl>
<dt style="cursor:context-menu"><dfn>context-menu</dfn></dt>
<dd>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.</dd>
<dt style="cursor:help"><dfn>help</dfn></dt>
<dd>Help is available for the object under the cursor.
Often rendered as a question mark or a balloon.
</dd>
<dt style="cursor:pointer"><dfn>pointer</dfn></dt>
<dd>The cursor is a pointer that indicates a link.
</dd>
<dt style="cursor:progress"><dfn>progress</dfn></dt>
<dd>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.</dd>
<dt style="cursor:wait"><dfn>wait</dfn></dt>
<dd>Indicates that the program is busy and the user should wait.
Often rendered as a watch or hourglass.
</dd>
</dl>
<dt>selection cursors
<dd>
<dl>
<dt style="cursor:cell"><dfn>cell</dfn></dt>
<dd>Indicates that a cell or set of cells may be selected. Often rendered as a thick plus-sign with a dot in the middle.</dd>
<dt style="cursor:crosshair"><dfn>crosshair</dfn></dt>
<dd>A simple crosshair (e.g., short line segments resembling a "+" sign).
Often used to indicate a two dimensional bitmap selection mode.
</dd>
<dt style="cursor:text"><dfn>text</dfn></dt>
<dd>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.
</dd>
<dt style="cursor:vertical-text"><dfn>vertical-text</dfn></dt>
<dd>Indicates vertical-text that may be selected. Often rendered as a horizontal I-beam.</dd>
</dl>
<dt>drag and drop cursors
<dd>
<dl>
<dt style="cursor:alias"><dfn>alias</dfn></dt>
<dd>Indicates an alias of/shortcut to something is to be created.
Often rendered as an arrow with a small curved arrow next to it.</dd>
<dt style="cursor:copy"><dfn>copy</dfn></dt>
<dd>Indicates something is to be copied.
Often rendered as an arrow with a small plus sign next to it.</dd>
<dt style="cursor:move"><dfn>move</dfn></dt>
<dd>Indicates something is to be moved.
</dd>
<dt style="cursor:no-drop"><dfn>no-drop</dfn></dt>
<dd>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.
</dd>
<dt style="cursor:not-allowed"><dfn>not-allowed</dfn></dt>
<dd>Indicates that the requested action will not be carried out.
Often rendered as a circle with a line through it.
</dd>
<dt style="cursor:grab"><dfn>grab</dfn></dt>
<dd>Indicates that something can be grabbed (dragged to be moved). Often rendered as the backside of an open hand.</dd>
<dt style="cursor:grabbing"><dfn>grabbing</dfn></dt>
<dd>Indicates that something is being grabbed (dragged to be moved). Often rendered as the backside of a hand with fingers closed mostly out of view.</dd>
</dl>
<dt>resizing and scrolling cursors
<dd>
<dl>
<dt>
<span style="cursor:e-resize"><dfn>e-resize</dfn></span>,
<span style="cursor:n-resize"><dfn>n-resize</dfn></span>,
<span style="cursor:ne-resize"><dfn>ne-resize</dfn></span>,
<span style="cursor:nw-resize"><dfn>nw-resize</dfn></span>,
<span style="cursor:s-resize"><dfn>s-resize</dfn></span>,
<span style="cursor:se-resize"><dfn>se-resize</dfn></span>,
<span style="cursor:sw-resize"><dfn>sw-resize</dfn></span>,
<span style="cursor:w-resize"><dfn>w-resize</dfn></span>
</dt>
<dd>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.
</dd>
<dt>
<span style="cursor:ew-resize"><dfn>ew-resize</dfn></span>,
<span style="cursor:ns-resize"><dfn>ns-resize</dfn></span>,
<span style="cursor:nesw-resize"><dfn>nesw-resize</dfn></span>,
<span style="cursor:nwse-resize"><dfn>nwse-resize</dfn></span>
</dt>
<dd>Indicates a bidirectional resize cursor.</dd>
<dt style="cursor:col-resize"><dfn>col-resize</dfn></dt>
<dd>Indicates that the item/column can be resized horizontally.
Often rendered as arrows pointing left and right with a vertical bar separating them.</dd>
<dt style="cursor:row-resize"><dfn>row-resize</dfn></dt>
<dd>Indicates that the item/row can be resized vertically.
Often rendered as arrows pointing up and down with a horizontal bar separating them.
</dd>
<dt style="cursor:all-scroll"><dfn>all-scroll</dfn></dt>
<dd>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.
</dd>
</dl>
<dt caniuse="css3-cursors-newer" id="zooming-cursors">zooming cursors
<dd>
<dl>
<dt>
<span style="cursor:zoom-in"> <dfn>zoom-in</dfn></span>,
<span style="cursor:zoom-out"> <dfn>zoom-out</dfn></span>
</dt>
<dd>
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.
</dd>
</dl>
</dl>
<div class="example">
Example: cursor fallback
Here is an example of using several cursor values.
<pre><code class="lang-css">
:link,:visited {
cursor: url(example.svg#linkcursor),
url(hyper.cur),
url(hyper.png) 2 3,
pointer
}
</code></pre>
This example sets the cursor on all hyperlinks (whether visited or not)
to an external <a href="https://www.w3.org/TR/SVG/interact.html#CursorElement">SVG cursor</a> ([[SVG11]], 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 hotspot.
Finally if the UA does not support any of those image cursor formats, the UA would skip to the last value
and render the ''pointer'' cursor.
</div>
<h5 id="canvas_cursor">Cursor of the canvas</h5>
The document <a href="https://www.w3.org/TR/CSS2/intro.html#the-canvas">canvas</a>
is the infinite surface over which the document is rendered [[!CSS2]].
Since no element corresponds to the canvas,
in order to allow styling of the cursor when not over any element,
the canvas cursor re-uses the root element's cursor.
However, if no boxes are generated for the root element
(for example, if the root element has ''display: none''),
then the canvas cursor is the platform-dependent default cursor.
Note: An element might be invisible,
but still generate boxes. For example,
if the element has ''visibility: hidden'' but not ''display: none'',
boxes are generated for it and its cursor is used for the canvas.
<h3 id="insertion-caret">Insertion caret</h3>
<h4 id="caret-color" caniuse="css-caret-color">Coloring the Insertion Caret: the 'caret-color' property</h4>
<pre class="propdef">
Name: caret-color
Value: auto | <<color>>
Initial: auto
Applies to: all elements
Inherited: yes
Percentages: N/A
Computed value: The computed value for ''caret-color/auto'' is ''caret-color/auto'';
the computed value of ''caret-color/currentColor'' is ''cart-color/currentColor'' (See [[CSS-COLOR-3/#currentColor]]);
see the 'color' property for other <<color>> values.
Animation type: by computed value
</pre>
<dl>
<dt><dfn dfn-type=value for=caret-color>auto</dfn></dt>
<dd>User agents should use currentColor.
User agents may automatically adjust the color of caret
to ensure good visibility and contrast with the surrounding content,
possibly based on the currentColor, background, shadows, etc.</dd>
<dt><<color>></dt>
<dd>The insertion caret is colored with the specified color.</dd>
</dl>
The caret is a visible indicator of the insertion point in an element where text (and potentially other content) is inserted by the user. This property controls the color of that visible indicator.
Note: caret shape and blinking is outside the scope of this feature and thus unspecified.
Note: UAs might have additional things that count as “carets”.
For example, some UAs can show a “navigation caret”,
which acts similarly to an insertion caret
but can be moved around in non-editable text,
and is functionally a caret.
On the other hand, the cursor image shown
when hovering over text when the 'cursor' property is ''cursor/auto'',
or when hovering over an element where the 'cursor' property is ''cursor/text'' or ''cursor/vertical-text'',
though it sometimes resembles a caret, is not a caret (it's a cursor).
<div class="example">
Example: a textarea with
<code class="lang-css">caret-color:#00aacc;</code>
<textarea style="caret-color:#00aacc;">
caret-color:#00aacc
</textarea>
</div><!-- example -->
<h3 id="keyboard">Keyboard control</h3>
<h4 id="input-method-editor">Obsolete: the ime-mode property</h4>
"ime-mode" is a property somewhat implemented in some browsers, that is problematic and officially obsoleted by this specification.
There is documentation of
<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/ime-mode">non-interoperability of these implementations.
</a>
User agents should not support the <css>ime-mode</css> property.
Authors must not use the ime-mode property.
Users may use the ime-mode property only for repair use-cases where they have to work around bad sites and legacy implementations, e.g. with a user style sheet rule like:
<div class="example">
<p>Example: user preference
<pre><code class="lang-css">input[type=password] {
ime-mode: auto&nbsp;!important;
}
</code></pre>
</div>
This example CSS may be placed into a user style sheet file to force password input fields to behave in a default manner.
This specification deliberately does not attempt to document the functionality of legacy ime-mode implementations nor what they specifically support because it does not make sense to pursue or recommend any such path.
<div class="note">
Note: there are several [[HTML]] features which authors should use to provide information to user agents that allow them to provide a better input user experience:
<ul>
<li>The global <code>lang</code> attribute
<li>The <code>inputmode</code>, <code>pattern</code>,
and <code>type</code> attributes of the input element
</ul>
</div>
<hr title="Separator from footer">
<h2 class="no-num" id="acknowledgments">Appendix A. Acknowledgments</h2>
This appendix is <em>informative</em>.
This specification 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.
Thanks to <span class="h-card">Florian Rivoal</span>, working on this specification on behalf of Bloomberg, for
his recent work documenting issues from www-style emails,
proposing resolutions &amp; changes,
and in particular for researching &amp; writing greatly
improved details for the 'box-sizing' property.
Thanks to feedback and contributions from
<span class="h-card">Rossen Atanassov</span>,
<span class="h-card">Tab Atkins</span>,
<span class="h-card">L. David Baron</span>,
<span class="h-card">Bert Bos</span>,
<span class="h-card">Matthew Brealey</span>,
<span class="h-card">Rick Byers</span>,
<span class="h-card">Ada Chan</span>,
<span class="h-card">James Craig</span>,
<span class="h-card">Michael Cooper</span>,
<span class="h-card">Axel Dahmen</span>,
<span class="h-card">Michael Day</span>,
<span class="h-card">Micah Dubinko</span>,
<span class="h-card">Elika E.</span>,
<span class="h-card">Steve Falkenburg</span>,
<span class="h-card">Andrew Fedoniouk</span>,
<span class="h-card">Al Gilman</span>,
<span class="h-card">Ian Hickson</span>,
<span class="h-card">Bjoern Hoehrmann</span>,
<span class="h-card">Alan Hogan</span>,
<span class="h-card">David Hyatt</span>,
<span class="h-card">Richard Ishida</span>,
<span class="h-card">Sho Kuwamoto</span>,
<span class="h-card">Yves Lafon</span>,
<span class="h-card">Stuart Langridge</span>,
<span class="h-card">Susan Lesch</span>,
<span class="h-card">Peter Linss</span>,
<span class="h-card">Kang-Hao Lu</span>,
<span class="h-card">Masayuki Nakano</span>,
<span class="h-card">Mats Palmgren</span>,
<span class="h-card">Brad Pettit</span>,
<span class="h-card">Chris Rebert</span>,
<span class="h-card">François Remy</span>,
<span class="h-card">Andrey Rybka</span>,
<span class="h-card">Simon Sapin</span>,
<span class="h-card">Alexander Savenkov</span>,
<span class="h-card">Sebastian Schnitzenbaumer</span>,
<span class="h-card">Lea Verou</span>,
<span class="h-card">Etan Wexler</span>,
<span class="h-card">David Woolley</span>,
<span class="h-card">Frank Yan</span>,
<span class="h-card">Boris Zbarsky</span>,
and
<span class="h-card">Domel</span>.
<h2 class="no-num" id="changes">Appendix B. Changes</h2>
This appendix is <em>informative</em>.
This appendix describes changes from the
<a href="https://www.w3.org/TR/2017/CR-css-ui-3-20170302/">Candidate Recommendation (CR) of 2 March 2017</a>.
<ul>
<li>Updated references to latest versions
<li>Editorial Clarification about the resize property
<li>Move (at risk) directional focus navigation properties from level 3 to level 4
<li>Add informative link to HTML about special handling of 'cursor' over image maps
<li>Clarify (as a SHOULD) the implications of text-overflow on pointer events to capture implementor consensus (<a href="https://github.com/web-platform-tests/wpt/commit/b749ca84fe5474adb4473c35a3da5788e5b6cfd7#diff-8667b2cb07cf6ee064b9f2a74e221e8f">corresponding test</a>).
<li>Clarify that UAs may ignore the cursor property to reflect the UA's UI state
<li>Allow, but stop requiring support for SVG images without intrinsic sizes for cursors (<a href="https://github.com/web-platform-tests/wpt/commit/92770f655298aa72b0c0ee9238377d6b04d2e3e6">corresponding test update</a>).
<li>Align the spec with implementations, and make ''cursor: auto'' look like ''cursor/text'' over <strong>selectable</strong> text, and over editable elements (<a href="https://github.com/web-platform-tests/wpt/commit/34c61eff5eab4ebe9ff271e46658f73f18858c4f">corresponding tests</a>).
</ul>
<h2 class="no-num" id="security-privacy-considerations">Appendix C. Considerations for Security and Privacy</h2>
This appendix is <em>informative</em>.
The W3C TAG is developing a
<a href="https://w3ctag.github.io/security-questionnaire/">Self-Review Questionnaire: Security and Privacy</a>
for editors of specifications to informatively answer.
Per the <a href="https://w3ctag.github.io/security-questionnaire/#questions">Questions to Consider</a>
<ol>
<li>Does this specification deal with personally-identifiable information?
<p>No.</p>
</li>
<li>Does this specification deal with high-value data?
<p>No.</p>
</li>
<li>Does this specification introduce new state for an origin that persists across browsing sessions?
<p>No.</p>
</li>
<li>Does this specification expose persistent, cross-origin state to the web?
<p>No.</p>
</li>
<li>Does this specification expose any other data to an origin that it doesn’t currently have access to?
<p>No.</p>
</li>
<li>Does this specification enable new script execution/loading mechanisms?
<p>Yes to loading, but not to execution. The 'cursor' property accepts <<image>> values which may include URLs to be loaded.
These may be SVG documents which may contain scripts,
but this specification requires that scripts must not be run.</p>
</li>
<li>Does this specification allow an origin access to a user’s location?
<p>No.</p>
</li>
<li>Does this specification allow an origin access to sensors on a user’s device?
<p>No.</p>
</li>
<li>Does this specification allow an origin access to aspects of a user’s local computing environment?
<p>No.</p>
</li>
<li>Does this specification allow an origin access to other devices?
<p>No.</p>
</li>
<li>Does this specification allow an origin some measure of control over a user agent’s native UI?
<p>Yes. The 'cursor' and 'caret-color' 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 ''outline-style/auto'' value (and thus 'outline' shorthand) enable the page to potentially display a native focused element outline presentation around any element.</p>
</li>
<li>Does this specification expose temporary identifiers to the web?
<p>No.</p>
</li>
<li>Does this specification distinguish between behavior in first-party and third-party contexts?
<p>No.</p>
</li>
<li>How should this specification work in the context of a user agent’s "incognito" mode?
<p>No differently.</p>
</li>
<li>Does this specification persist data to a user’s local device?
<p>No.</p>
</li>
<li>Does this specification have a "Security Considerations" and "Privacy Considerations" section?
<p>Yes.</p>
</li>
<li>Does this specification allow downgrading default security characteristics?
<p>No.</p>
</li>
</ol>
<h2 class="no-num" id="default-style-sheet">Appendix D. Default style sheet additions for HTML</h2>
This appendix is <em>informative</em>.
Potential additions to the base style sheet to express HTML form controls, and a few dynamic presentation attributes:
<pre class="lang-css">
:enabled:focus {
outline: 2px inset;
}
button,
input[type=button],
input[type=reset],
input[type=submit],
input[type=checkbox],
input[type=radio],
textarea,
input,
input[type=text],
input[type=password],
input[type=image]
{
display: inline-block;
}
input[type=button],
input[type=reset],
input[type=submit],
input[type=checkbox],
input[type=radio],
input,
input[type=text],
input[type=password],
input[type=image]
{
white-space: nowrap;
}
button
{
/* white space handling of BUTTON tags in particular */
white-space:normal;
}
input[type=reset]:lang(en)
{
/* default content of HTML input type=reset button, per language */
content: "Reset";
}
input[type=submit]:lang(en)
{
/* default content of HTML input type=submit button, per language */
content: "Submit";
}
/* UAs should use language-specific Reset/Submit rules for others. */
input[type=button],
input[type=reset][value],
input[type=submit][value]
{
/* text content/labels of HTML "input" buttons */
content: attr(value);
}
textarea
{
/* white space handling of TEXTAREA tags in particular */
white-space:pre-wrap;
resize: both;
}
input[type=hidden]
{
/* appearance of the HTML hidden text field in particular */
display: none !important;
}
input[type=image]
{
content: attr(src,url);
border: none;
}
select[size]
{
/* HTML4/XHTML1 &lt;select&gt; w/ size more than 1 - appearance of list */
display: inline-block;
height: attr(size,em);
}
select,select[size=1]
{
/* HTML4/XHTML1 &lt;select&gt; without size, or size=1 - popup-menu */
display: inline-block;
height: 1em;
overflow: hidden;
}
select[size]:active
{
/* active HTML &lt;select&gt; w/ size more than 1 - appearance of active list */
display: inline-block;
}
optgroup,option
{
display: block;
white-space: nowrap;
}
optgroup[label],option[label]
{
content: attr(label);
}
option[selected]::before
{
display: inline;
content: check;
}
/* 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 }
*/
</pre>
You can’t perform that action at this time.