FFFF csswg-drafts/css3-ui/Overview.src.html at a80809970da16e31926c21f0a8a04359ad295adb · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
executable file
·
2734 lines (2323 loc) · 121 KB

File metadata and controls

executable file
·
2734 lines (2323 loc) · 121 KB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!-- the command line to process is this is:
num -l 2 template.html | toc -l 2 | perl bin/htmlindex | perl \
bin/propindex | perl bin/addcite -r '' template.html \
>template-processed.html
To do: add longdesc
-->
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Language" content="en">
<meta name="author" lang="tr" content="Tantek &Ccedil;elik">
<title>CSS Basic User Interface Module Level 3 (CSS3 UI)</title>
<link href="../default.css" rel="stylesheet" type="text/css" title="Default">
<style type="text/css">
.subtoc ul,.subtoc ol { list-style-type: none }
ol.objectives { list-style: decimal }
ol.issues { list-style: decimal }
.html4ss { font-size:90%}
table.twod { border: solid 2px #777; font-family:sans-serif; font-size:9px }
table.twod td { border: solid 1px #777; font-family:sans-serif; font-size:9px }
table.twod th { font-size:10px; font-weight:bold }
h1 {font-size:200%; clear:both}
h2 {font-size:170%; clear:both}
h3 {font-size:150%; clear:both}
h4 {font-size:130%}
h5 {font-size:120%}
h6 {font-size:110%}
h1+h2 {page-break-before: avoid}
h2 {page-break-before: always}
dd p:first-child { margin-top:0 }
table.tprofile th.title {background:gray; color:white}
table.tprofile th { width:29%;padding:2px }
table.tprofile td { width:71%;padding:2px }
table#egappearance td:first-child { text-align:center; line-height:1.5 }
table#egappearance label { white-space:nowrap }
table#egappearance fieldset { line-height:1.4 }
table#egappearance legend { line-height:1.1 }
</style>
<link rel="stylesheet" type="text/css"
href="http://www.w3.org/StyleSheets/TR/W3C-ED">
</head>
<body>
<div class="head">
<a href="http://www.w3.org/"><img height="48" width="72" alt="W3C"
src="http://www.w3.org/Icons/w3c_home">
</a>
<h1>CSS Basic User Interface Module Level 3</h1>
<h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
<dl>
<dt>This version:</dt>
<!-- <dd><a href="http://www.w3.org/TR/[YEAR]/[STATUS]-[SHORTNAME]-[CDATE]">http://www.w3.org/TR/[YEAR]/[STATUS]-[SHORTNAME]-[CDATE]</a></dd> -->
<dd><a href="http://dev.w3.org/csswg/css3-ui/">http://dev.w3.org/csswg/css3-ui/</a></dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/[SHORTNAME]">http://www.w3.org/TR/[SHORTNAME]</a></dd>
<dt>Latest editor's draft:</dt>
<dd><a href="http://dev.w3.org/csswg/css3-ui/">http://dev.w3.org/csswg/css3-ui/</a></dd>
<dt>Issues list:</dt>
<dd><a href="http://wiki.csswg.org/spec/css3-ui">http://wiki.csswg.org/spec/css3-ui</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2004/CR-css3-ui-20040511/">http://www.w3.org/TR/2004/CR-css3-ui-20040511/</a></dd>
<dt>Editor:</dt>
<dd class="vcard h-card"><a lang="tr" class="fn p-fn url u-url" href="http://tantek.com">Tantek &Ccedil;elik</a>
(<a class="company org h-org" href="http://www.mozilla.org/">Mozilla Foundation</a>,
and before at <a href="http://www.microsoft.com/">Microsoft Corporation</a>)
&lt;<a class="email u-email"
href="mailto:tantek@cs.stanford.edu">tantek@cs.stanford.edu</a>&gt;
</dd>
</dl>
<!--copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>This section is <em>informative</em>.</p>
<p>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&nbsp;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&nbsp;2 revision 1 and Selectors specifications.
</p>
<h2 style="page-break-before:auto" class="no-num no-toc" id="status">Status of this document</h2>
<!--status-->
<p>This specification is a <strong>Last Call Working
Draft</strong>, 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 <a
href="htt F328 p://www.w3.org/2005/10/Process-20051014/tr.html#cfi">required</a>
by the W3C Process.
<!-- This specification may advance directly to Proposed
Recommendation following the last call, depending on comments and
implementation reports. -->
All persons are encouraged to review this
document and send comments to the <a
href="http://lists.w3.org/Archives/Public/www-style/">www-style
mailing list</a> as described above. The <strong>deadline for
comments</strong> is
<strong>SOMETIME IN THE FUTURE AFTER A PUBLIC LCWD IS PUBLISHED</strong>.
</p>
<h3 class="no-num no-toc" id="crec">Candidate Recommendation Exit Criteria</h3>
<p>For this specification to enter the Proposed Recommendation stage,
the following conditions shall be met:</p>
<ol>
<li>
<p>There must be at least two interoperable implementations
for every feature. For the purposes of this criterion,
we define the following terms:</p>
<dl>
<dt>feature</dt>
<dd>
<p>
A section or subsection of the specification.
</p>
</dd>
<dt>interoperable</dt>
<dd>
<p>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.</p>
</dd>
<dt>implementation</dt>
<dd>
<p>a user agent which:</p>
<ol class=inline>
<li>implements the feature.</li>
<li>is available (i.e. publicly downloadable or available
through some other public point of sale mechanism). This is the
"show me" requirement.</li>
<li>is shipping (i.e. development, private or unofficial
versions are insufficient).</li>
<li>is not experimental (i.e. is intended for a wide audience
and could be used on a daily basis).</li>
</ol>
</dd>
</dl>
</li>
<li><p>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.</p></li>
<li><p>The CR period will be extended if implementations are slow to
appear.</p></li>
<li><p>Features that are <em>at risk</em> (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.</p></li>
</ol>
<p>A <a href="/Style/CSS/Test/">test suite</a> and a <a
href="/Style/css3-updates/css3-ui-implementations">report on
implementations</a> will be provided before the document becomes a
Proposed Recommendation.
</p>
<h3 class="no-num no-toc" id="atrisk">Features at risk</h3>
<p>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 dependencies for another specification (e.g. XForms [[XFORMS10]]) or are believed to have one or more implementations (perhaps experimental), and thus will not be dropped without returning to last call.</p>
<ul>
<!--
At risk due to only one implementation, or obsolete dependency:
XForms is defunct on the web.
<li>XForms needs: :default :valid :invalid :in-range :out-of-range :required :optional :read-only :read-write ::value ::choices ::repeat-item ::repeat-index</li>
<li>appearance: (no interop)
Webkit implements: -webkit-appearance - unknown which values
Moz implements: -moz-appearance
checkbox tab tooltip window dialog menubar
none(same as normal) button(same as push-buttom) radio(same as radio-button) menupopup(same as pop-up-menu) menuitem(same as menu-item)
checkboxcontainer(same as checkbox-group?) radiocontainer(same as radio-group?)
treeview(same as outline-tree?) textfield(same as field) menulist(same as list-menu?) slider(same as range?) menulist(same as pull-down-menu?)
listbox? listitem?
hyperlink (with a different mechanism?)
XForms asked for and/or needs:
combo-box signature password
Required generic values:
icon button menu
Necessary to replace old CSS3 Color values, so they can be deprecated
document workspace desktop
</li>
<li>box-sizing: padding-box - only FF supports in prefixed version</li>
<li>ime-mode: new - not sure about IE5+ vs FF3+ interop
</li>
Not at risk:
<li>CSS2.1: :hover :active :focus</li>
<li>Selectors: :enabled :disabled :checked :indeterminate ::selection</li>
<li>box-sizing implemented by IE5/Mac, Opera
-moz-box-sizing implemented by Mozilla
</li>
<li>outline, outline-width, outline-color, outline-style all in CSS 2.1</li>
<li>outline-offset property
implemented by Safari 1.2
</li>
<li>cursor property:
CSS2.1: auto | default | help | pointer | wait | crosshair | text |
e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize
IE5/Mac implements: none | progress | cell
IE6/Windows implements: <uri> | progress | not-allowed | no-drop | vertical-text | all-scroll | col-resize | row-resize | move |
Mozilla implements: progress | cell(as -moz-cell) | alias(as -moz-alias) | copy(as -moz-copy) | context-menu(as -moz-context-menu) |
freedesktop.org copied all the cursors from the CSS3-UI LC Working Draft
by FredrikHoeglund - 14 Oct 2003
http://freedesktop.org/Standards/cursor-spec
</li>
<li>'cursor' property values: ew-resize | ns-resize | nesw-resize | nwse-resize
implemented by Firefox and Safari
</li>
<li>pointer-events property:
implemented by Firefox 3.6 and later, Safari 4 and later, Opera v?
</li>
<li>nav-* properties
implemented by Opera, Tasman v1 internal implementation
required (depended on) by DVB-HTML, ATSC standards
</li>
<li>'resize' property
implemented by Firefox 4 and Safari
</li>
-->
<li>::value ::choices ::repeat-item ::repeat-index pseudo-elements</li>
<li>'appearance' property and values</li>
<li>'font' property values: window | document | workspace | desktop | tooltip | dialog | button | push-button | hyperlink | radio-button | checkbox | menu-item | tab | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password
</li>
<li>'box-sizing' property value: padding-box</li>
<li>'content' property value: icon</li>
<li>'icon' property</li>
<li>'ime-mode' property</li>
<li>'text-overflow' property value: &lt;string&gt;</li>
<li>'text-overflow' property 2-value syntax and definition.</li>
</ul>
<h2 class="no-num no-toc" id="summary">Overview</h2>
<p>This section is <em>informative</em>.</p>
<p>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
<a href="http://www.w3.org/TR/REC-CSS1">CSS1</a> [[CSS1]]
and <a href="http://www.w3.org/TR/CSS21">CSS2.1</a> [[!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".
</p>
<p>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.
</p>
<ul>
<li>Cascading Style Sheets, level 2, revision 1 [[!CSS21]]</li>
<li><a href="http://www.w3.org/TR/2000/WD-css3-userint-20000216">User Interface for CSS3 (16 February 2000)</a> [[CSSUI]]</li>
</ul>
<p>This specification contains:
</p>
<ul>
<li>Pseudo-classes and pseudo-elements to style
user interface states and element fragments respectively.
</li>
<li>Additions to the user interface features in
<a href="http://www.w3.org/TR/CSS21">CSS2.1</a>.</li>
<li>The ability to style the appearance of various standard
form elements in languages such as HTML/XHTML/XForms (and
properties to augment or replace some of the remaining stylistic attributes in HTML4/XHTML1).</li>
<li>Directional focus navigation properties.</li>
<li>A mechanism to allow the styling of elements as icons for accessibility.</li>
</ul>
<h2 class="no-num no-toc" id="contents">Table of contents</h2>
<!--toc-->
<hr>
<h2 id="intro">Introduction</h2>
<p>This section is <em>normative</em>.</p>
<p>
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.
</p>
<p>
This module describes selectors and CSS properties which enable authors
to style user interface related states, element fragments, properties
and values.
</p>
<p><a href="http://www.w3.org/TR/REC-CSS1#anchor-pseudo-classes">Section 2.1 of CSS1</a> [[CSS1]]
and <a href="http://www.w3.org/TR/CSS2/ui.html">Chapter 18 of CSS2</a> [[CSS2]]
introduced several user interface related pseudo-classes, properties and values.
<a href="http://www.w3.org/TR/css3-selectors/#UIstates">Section 6.6.4 of Selectors</a> [[!SELECT]] also describes several additional user interface related pseudo-classes (and one pseudo-element).
</p>
<p>
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.
</p>
<h3 id="purpose">Purpose</h3>
<p>The purpose of this specification is to achieve the following objectives:
</p>
<ul>
<li>Extend the user interface features in CSS2.1.</li>
<li>Provide additional CSS mechanisms to simulate the appearance
of various standard form elements.</li>
<li>Provide additional CSS mechanisms to augment or replace other
dynamic presentation related features in HTML4/XHTML1.</li>
<li>Introduce directional navigation properties to assist in the construction of
user interfaces which make use of a directional navigation model.</li>
<li>Introduce properties and values to specify icon presentations for
elements to enhance accessibility.</li>
</ul>
<h3 id="scope">Scope</h3>
<p>This proposal specifies how to alter the look and feel of various elements,
and specifically does not address the meaning behind what a specific look and feel may imply.
For example, with the additions in the proposal, an author can make any element look and even feel like a submit button. Yet, that arbitrary element is not afforded any additional meaning,
so pushing it does nothing by default, and certainly does not submit a form.
</p>
<p>
Similarly, the HTML4 & 67F6 lt;code>&lt;SELECT&gt;</code> element for example, provides a list or menu of choices to the user.
The meaning of the HTML4 <code>&lt;SELECT&gt;</code> element is that it allows the user to make a choice, to choose
something among several alternatives. This says nothing about its look and feel, and
in fact, the "concept" of a HTML4 <code>&lt;SELECT&gt;</code> could be visually implemented as a list-box,
a popup-menu, or a group of radio-buttons.
Or a group of HTML4 checkboxes (<code>&lt;INPUT type="checkbox"&gt;</code>) could be styled to appear as a group of radio-buttons, and yet, since those elements are still semantic checkboxes, they can still be individually checked or unchecked, rather than acquiring any kind of radio-button group semantic where only one can be checked.
</p>
<p>
Each example of presentation has a different look and feel, but maintains its original meaning, a choice (or choices) among several alternatives.
This proposal addresses only the former (look and feel), not the latter (meaning).
</p>
<p>
Since this proposal serves to simulate the appearance of various user interface and forms elements in HTML4/XHTML, it is perhaps useful to call out what specifically is believed to be outside the scope of CSS, or better suited to document structure rather than style and therefore not addressed by this proposal:
</p>
<ul>
<li>Form semantics, including, but not limited to, submission, resetting,
naming, what determines a successful or valid form control,
and how to process form data.
</li>
<li>Form contents, including, but not limited to initial value, current value, and form content types. The HTML4 '<code>maxlength</code>' attribute, for example, determines the maximum number of characters the user can enter into an <code>&lt;INPUT type="text"&gt;</code> or <code>&lt;INPUT type="password"&gt;</code> field, and as such is a content constraint rather than a presentational suggestion.
</li>
<li>Form control dependencies, including, but not limited to, whether only one option from a set of choices may be chosen, or whether multiple options may be chosen.
</li>
<li>The HTML4/XHTML1 <code>&lt;form&gt;</code> element and its unique attributes ('<code>action</code>', '<code>method</code>', '<code>enctype</code>', '<code>accept</code>', '<code>accept-charset</code>').
</li>
</ul>
<p>In addition, this document does not attempt to solve all user interface
related issues / features that can be found in modern user interfaces. Perhaps future versions may attempt to solve these. For example:
</p>
<ul><li>Complex or composite controls (e.g. the HTML4 <code>&lt;INPUT type="file"&gt;</code> and the <code>&lt;ISINDEX&gt;</code> elements).</li>
<li>The appearance, styling and coloring of scrollbars.</li>
<li>Window layering. There is no attempt made to distinguish the appearance
of elements in the front-most window versus non-front-most windows.
The semantics of window layering must be addressed
before it is appropriate to attempt to style such concepts.</li>
<li>Palettes and floating windows. Along with the concept of "frontmost" window, windows that float but do not receive focus are also not addressed.</li>
<li>Browser window chrome and toolbars.</li>
<li>The default styling of the HTML4/XHTML1 <code>&lt;fieldset&gt;</code>, <code>&lt;legend&gt;</code>, <code>&lt;frame&gt;</code> and <code>&lt;frameset&gt;</code> elements.</li>
<li>Frame-resizing behavior. The behavior of <code>&lt;frame&gt;</code> and <code>&lt;frameset&gt;</code>, specifically the ability to "share" resizability when elements share a border, perhaps by leveraging the border-collapse property is also not addressed.
</li>
</ul>
<h2>Conformance</h2>
<p>This section is <em>normative</em>.</p>
<h3>Definitions</h3>
<p>The key words <span class="index-def" title="MUST">"MUST"</span>,
<span class="index-def" title="MUST NOT">"MUST NOT"</span>, <span
class="index-def" title="REQUIRED">"REQUIRED"</span>, <span
class="index-def" title="SHALL">"SHALL"</span>, <span
class="index-def" title="SHALL NOT">"SHALL NOT"</span>, <span
class="index-def" title="SHOULD">"SHOULD"</span>, <span
class="index-def" title="SHOULD NOT">"SHOULD NOT"</span>, <span
class="index-def" title="RECOMMENDED">"RECOMMENDED"</span>, <span
class="index-def" title="MAY">"MAY"</span>, and <span
class="index-def" title="OPTIONAL">"OPTIONAL"</span> in this document
are to be interpreted as described in RFC&nbsp;2119 (see [[!RFC2119]]).
However, for readability, these words do not typically appear in all uppercase
letters in this specification.
</p>
<p>Additional key words, e.g. "User agent (UA)", are <a href="http://www.w3.org/TR/CSS21/conform.html#q1">defined by CSS 2.1</a> ([[!CSS21]], section 3.1).</p>
<h3>Classes of products</h3>
<p>The following classes of products (many of which overlap) should consider implementing this specification:</p>
<ul>
<li>Web browsers</li>
<li>User agents that implement one or more of the following types of content: HTML (e.g. [[HTML401]]), XHTML (e.g. [[XHTML10]], [[XHTML11]]), XForms (e.g. [[XFORMS10]]), SVG (e.g. [[SVG10]], [[SVG11]]) or other content languages that contain forms controls or are intended for user interaction</li>
<li>User agents that implement one or more levels, modules and or profiles of CSS (e.g. [[CSS1]], [[!CSS21]])</li>
</ul>
<h3>Profiles</h3>
<p>This specification contains a number of informative profiles. These profiles are not mandatory for conformance.</p>
<h3>Extensions</h3>
<p>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. <a href="http://www.w3.org/TR/CSS21/syndata.html#q4">Vendor-specific extensions</a> ([[!CSS21]], section 4.1.2).
</p>
<h2>Dependencies on other modules</h2>
A3CA <p>This section is <em>normative</em>.</p>
<p>This CSS3 module depends on the following other specifications. Some of these specifications may be in their "Candidate Recommendation" phase. If this module depends on feature or portion of such a specification which ends up being dropped during their "CR" phase(s), then such feature or portion thereof will be presumed to be incorporated into this specification. For example, if the ":indeterminate" selector was dropped from Selectors, then the definition and description of ":indeterminate" would be incorporated into the next draft of this specification.</p>
<ul>
<li>[[!SELECT]]</li>
<li>[[!CSS3COLOR]]</li>
<li>[[!CSS21]]</li>
</ul>
<!--
<p>It has non-normative (informative) references to the following
other specifications:</p>
<ul>
</ul>
-->
<p>
The following work is related to the CSS Basic User Interface Module Level 3 (CSS3 Basic UI).
</p>
<ul>
<li>[[HTML401]]</li>
<li>[[UAAG10]]</li>
<li>[[XML10]]</li>
<li>[[XHTML10]]</li>
<li>[[XHTML11]]</li>
<li>[[XFORMS10]]</li>
</ul>
<p>This specification does not define what is a form element.</p>
<h2>User Interface Selectors</h2>
<p>This section is <em>normative</em>.</p>
<h3 id="pseudo-classes">User interface states: pseudo-classes</h3>
<p>The Selectors specification <a href="http://www.w3.org/TR/css3-selectors/#UIstates">defines several user interface selectors</a> ([[!SELECT]], sections 6.6.1 and 6.6.4) which represent
user interface states:</p>
<ul><li id="psuedo-hover"><a href="http://www.w3.org/TR/css3-selectors/#useraction-pseudos">:hover</a></li>
<li id="pseudo-active"><a href="http://www.w3.org/TR/css3-selectors/#useraction-pseudos">:active</a></li>
<li id="pseudo-focus"><a href="http://www.w3.org/TR/css3-selectors/#useraction-pseudos">:focus</a></li>
<li id="pseudo-enabled"><a href="http://www.w3.org/TR/css3-selectors/#enableddisabled">:enabled</a></li>
<li id="pseudo-disabled"><a href="http://www.w3.org/TR/css3-selectors/#enableddisabled">:disabled</a></li>
<li id="pseudo-checked"><a href="http://www.w3.org/TR/css3-selectors/#checked">:checked</a></li>
<li id="pseudo-indeterminate"><a href="http://www.w3.org/TR/css3-selectors/#indeterminate">:indeterminate</a></li>
</ul>
<p>These pseudo-classes as defined by [[!SELECT]] are included in this specification by reference.</p>
<p>CSS 2.1 [[!CSS21]] specifies additional details for some of the selectors mentioned, above and beyond Selectors.
</p>
<h4 id="active">:active details</h4>
<p>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.</p>
<div class="example"><p style="display:none">Example(s):</p>
<h4 class="no-num no-toc">restyling a checkbox</h4>
<p>
Authors may wish to completely redo the styling of a form control, such as a checkbox. This can be achieved using several of the above pseudo-classes and the '<span class="value">normal</span>' value for the <span class="property">'appearance'</span> property which is explained later in this specification. In this example, checkboxes with a class of "redone" are styled with specific background images according to their respective user interface states using one or more pseudo-classes.
</p>
<pre><code class="css">
input[type=checkbox] {
appearance:checkbox; /* expected from UA defaults */
}
input[type=checkbox].redone {
appearance:normal; /* resets various properties */
display:inline-block;
width:20px; height:20px;
background:url(customuncheckedimage.png);
}
input[type=checkbox].redone:active {
background:url(customuncheckedactiveimage.png);
}
input[type=checkbox].redone:checked {
background:url(customcheckedimage.png);
}
input[type=checkbox].redone:checked:active {
background:url(customcheckedactiveimage.png);
}
input[type=checkbox].redone:disabled {
background:url(customdisableduncheckedimage.png);
}
input[type=checkbox].redone:disabled:checked {
background:url(customdisabledcheckedimage.png);
}
</code></pre>
</div>
<h4 class="no-num no-toc">New user interface state pseudo-classes</h4>
<p>In addition to the above-mentioned pseudo-classes, this specification introduces several new pseudo-classes to define additional user interface states.
</p>
<ul><li>:default</li>
<li>:valid</li>
<li>:invalid</li>
<li>:in-range</li>
<li>:out-of-range</li>
<li>:required</li>
<li>:optional</li>
<li>:read-only</li>
<li>:read-write</li>
</ul>
<p>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 [[XFORMS10]].</p>
<h4 id="pseudo-default">:default</h4>
<p>The :default selector applies to the one or more UI elements that are the default among a set of similar elements. Typically applies to context menu items, buttons and select lists/menus.
</p>
<p>
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.
</p>
<h4 id="pseudo-validity"><span id="pseudo-valid">:valid</span>
and <span id="pseudo-invalid">:invalid</span></h4>
<p>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. [[XFORMS10]]).
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.
</p>
<h4 id="pseudo-range"><span id="pseudo-in-range">:in-range</span> and <span id="pseudo-out-of-range">:out-of-range</span></h4>
<p>
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".
</p>
<h4 id="pseudo-required-value"><span id="pseudo-required">:required</span>
and <span id="pseudo-optional">:optional</span></h4>
<p>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.
</p>
<h4 id="pseudo-ro-rw"><span id="pseudo-read-only">:read-only</span>
and <span id="pseudo-read-write">:read-write</span></h4>
<p>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.</p>
67F6
<h3 id="pseudo-elements">User interface element fragments: pseudo-elements</h3>
<p>Selectors ([[!SELECT]], section 7.3) also defines one user interface element fragment selector:</p>
<ul><li id="pseudo-selection"><a href="http://www.w3.org/TR/css3-selectors/#selection">::selection</a></li>
</ul>
<p>This pseudo-element is included in this specification as defined by [[!SELECT]] by reference.</p>
<p>In addition to the above-mentioned pseudo-element, this specification introduces four new pseudo-elements to provide access to additional user interface element fragments.
</p>
<ul><li>::value</li>
<li>::choices</li>
<li>::repeat-item</li>
<li>::repeat-index</li>
</ul>
<p>Specifically, these new pseudo-elements are provided as a way to style user interface fragments as defined by XForms [[XFORMS10]].</p>
<h4 id="pseudo-value">::value</h4>
<p>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.
</p>
<div class="example"><p style="display:none">Example(s):</p>
<h4 class="no-num no-toc">fictional markup and illustration</h4>
<p>
Here is an example which illustrates the ::value of a text input field with fictional markup which is then styled with CSS.
</p>
<h5 class="no-num no-toc">sample XForms fragment with fictional markup:</h5>
<pre><code>
&lt;input&gt;
&lt;label&gt;Zip code&lt;label&gt;
<em>&lt;input::value/&gt;</em>
&lt;/input&gt;
</code></pre>
<h5 class="no-num no-toc">sample CSS:</h5>
<pre><code class="css">
input { border:dashed }
label { border:dotted }
input::value { border:solid }
</code></pre>
<h5 class="no-num no-toc">an HTML+CSS approximation of this example</h5>
<p>
<span style="border:dashed;display:inline-block;padding:10px">
<label
style="border:dotted;display:inline-block;padding:2px;margin:0;font-size:1em"
>Zip code</label>
<input type="text"
style="border:solid;display:inline-block;padding:2px;margin:0;font-size:1em"
value="94117">
</span>
</p>
<p>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.
</p>
</div>
<p>The ::value pseudo-element is similar to an inline-level element, but with certain restrictions.
The following properties apply to <code>::value</code>
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.
</p>
<h4 id="pseudo-choices">::choices</h4>
<p>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.
</p>
<p>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.</p>
<h4 id="pseudo-repeat-item">::repeat-item</h4>
<p>
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. '<code>relevant</code>') found there, as the related style properties will cascade to the child elements.
</p>
<h4 id="pseudo-repeat-index">::repeat-index</h4>
<p>
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.
</p>
<div class="note"><p>
<em><strong>Note.</strong>
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.
</em></p>
</div>
<div class="example"><p style="display:none">Example(s):</p>
<h4 class="no-num no-toc">::repeat-item and ::repeat-index fictional markup</h4>
<p>
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.
</p>
<p>The following markup snippet uses XHTML and XForms:</p>
<pre><code lang="x-xhtml">
&lt;html:table xforms:repeat-nodeset="..."&gt;
&lt;html:tr&gt;
&lt;html:td&gt;&lt;xforms:input ref="..."/&gt;&lt;xforms:input ref="..."/&gt;&lt;/html:td&gt;
&lt;/html:tr&gt;
&lt;/html:table&gt;
</code></pre>
<p>
The following style rules are used to style all the repeated items and the current repeated item.
</p>
<pre><code class="css" lang="x-css">
html|tr::repeat-item { outline: medium solid; color:gray }
html|tr::repeat-index { outline: medium dashed; color:black }
</code></pre>
<p>
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.
</p>
<pre><code lang="x-xhtml">
&lt;html:table xforms:repeat-nodeset="..."&gt;
<em>&lt;html:tr::repeat-item&gt;</em>
&lt;html:tr&gt;
&lt;html:td&gt;&lt;xforms:input ref="..."/&gt;&lt;xforms:input ref="..."/&gt;&lt;/html:td&gt;
&lt;/html:tr&gt;
<em>&lt;/html:tr::repeat-item&gt;</em>
<em>&lt;html:tr::repeat-item&gt;</em>
&lt;html:tr&gt;
&lt;html:td&gt;&lt;xforms:input ref="..."/&gt;&lt;xforms:input ref="..."/&gt;&lt;/html:td&gt;
&lt;/html:tr&gt;
<em>&lt;/html:tr::repeat-item&gt;</em>
<em>&lt;html:tr::repeat-index&gt;</em>
&lt;html:tr&gt;
&lt;html:td&gt;&lt;xforms:input ref="..."/&gt;&lt;xforms:input ref="..."/&gt;&lt;/html:td&gt;
&lt;/html:tr&gt;
<em>&lt;/html:tr::repeat-index&gt;</em>
&lt;/html:table&gt;
</code></pre>
</div>
<div class="note"><p>
<em><strong>Note.</strong>
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.</em></p>
</div>
<div class="example"><p style="display:none">Example(s):</p>
<h4 class="no-num no-toc">UI selectors example from XForms 1.0</h4>
<p>
The following <a href="http://www.w3.org/TR/xforms/sliceF.html#id2645356">example from XForms 1.0</a> ([[XFORMS10]], section F.3) shows how basic styling can be accomplished on form controls and repeating structures using the new pseudo-classes and XForms elements.
</p>
<pre><code class="css">
@namespace xforms url(http://www.w3.org/2002/xforms);
/* Display a red background on all invalid form controls */
*:invalid { background-color:red; }
/* Display a red asterisk after all required form controls */
*:required::after { content: "*"; color:red; }
/* Do not render non-relevant form controls */
*:disabled { visibility: hidden; }
/* The following declarations cause form controls and their labels
to align neatly, as if a two-column table were used */
xforms|group { display: table; }
xforms|input { display: table-row; }
xforms|input &gt; xforms|label { display: table-cell; }
xforms|input::value { border: thin black solid; display: table-cell; }
/* Display an alert message when appropriate */
*:valid &gt; xforms|alert { display: none; }
*:invalid &gt; xforms|alert { display: inline; }
/* Display repeat-items with a dashed border */
*::repeat-item,*::repeat-index { border: dashed; }
/* Display a teal highlight behind the current repeat item */
*::repeat-index { background-color: teal; }
</code></pre>
</div>
<h2>System Appearance</h2>
<p>This section is <em>normative</em>.</p>
<h3 id="appearance-val">Appearance values</h3>
<p>
CSS2 introduced the concept of system colors, which is a set of keywords that allows authors to specify colors in a manner that integrates them into the user's graphic environment. However, color is not the only property for which native form controls have a default.
</p>
<p>The properties defined and extended in this section refer to the <dfn>&lt;appearance&gt;</dfn> value type, which may take one of the following values which have been derived from the <a href="http://www.w3.org/TR/CSS21/ui.html#system-colors">list of CSS2.1 System Colors</a> ([[!CSS21]], section 18.2), the list of <a href="http://www.w3.org/TR/html401/interact/forms.html">HTML4 form controls</a> ([[HTML401]], section 17), and additional typical platform user interface (UI) controls (e.g. dialog window, icon):
</p>
<dl>
<dt>icon</dt>
<dd>a small picture representing an object, often with a name or label.</dd>
<dt>window</dt>
<dd>a viewport, a framed surface used to present objects and content for user viewing and interaction. There are several specific types of windows:
<dl><dt>desktop</dt>
<dd>a window used to represent a system as a whole that often contains other windows.</dd>
<dt>workspace</dt>
<dd>a window used to represent a project or application that may contain other windows, typically with a titlebar that shows the name of the project or application.</dd>
<dt>document</dt>
<dd>a window used to represent a user document, typically with a titlebar that shows its name. May also be used to represent folders or directories in a file system.</dd>
<dt>tooltip</dt>
<dd>a window that is used to temporarily display information or help about an object. Also called "info" in the CSS2 system colors.</dd>
<dt>dialog</dt>
<dd>a window used to present a notification or alternatives for the user to choose as part of an action taken by the user. Also called "message-box" in the CSS2 system fonts.</dd>
</dl>
</dd>
<dt>button</dt>
<dd>a small object usually labeled with text that represents a user choice
<dl><dt>push-button</dt>
<dd>a button that has a border surrounding it, often beveled to appear three dimensional, as if it is raised. Also called "caption" in CSS2 system fonts.</dd& 2334 gt;
<dt>hyperlink</dt>
<dd>a button that represents a hypertext link, often as simple as normal text that is underlined and perhaps colored differently.</dd>
<dt>radio-button</dt>
<dd>a button that displays whether or not it is checked with a small circle next to the button label. There may be a disc inside the circle when the button is checked. An indeterminate (neither checked nor unchecked) state may be indicated with some other graphic in the circle.</dd>
<dt>checkbox</dt>
<dd>a button that displays whether or not it is checked with a small box next to the button label. There may be an 'x' or check mark inside the box when the button is checked. An indeterminate (neither checked nor unchecked) state may be indicated with a dash '-' or a square or some other graphic in the box.</dd>
<dt>menu-item</dt>
<dd>a choice within a menu, which may also act as a label for a nested (hierarchical) menu.</dd>
<dt>tab</dt>
<dd>a button representing the label for a pane in a tabbed interface.</dd>
</dl>
</dd>
<dt>menu</dt>
<dd>a set of options for the user to choose from, perhaps more than one at a time. There are several specific types of menus.
<dl><dt>menubar</dt>
<dd>a menu of menus, typically arranged linearly, in a horizontal bar.</dd>
<dt>pull-down-menu</dt>
<dd>a menu where the name of the menu is displayed and the options remain hidden until the user activates the menu. When the user releases or deactivates the menu, the options are hidden again.</dd>
<dt>pop-up-menu</dt>
<dd>a menu where all but the currently selected option remains hidden until the user activates the menu. When the user releases or deactivates the menu, all but the selected option are hidden again.</dd>
<dt>list-menu</dt>
<dd>a list of options for the user to choose from, perhaps more than one at a time.</dd>
<dt>radio-group</dt>
<dd>a menu where the options are displayed as radio-buttons.</dd>
<dt>checkbox-group</dt>
<dd>a menu where the options are displayed as checkboxes.</dd>
<dt>outline-tree</dt>
<dd>a menu where the options can be shown or hidden with small widgets, often represented by a small triangle or plus and minus signs.</dd>
<dt>range</dt>
<dd>a control that displays the current option, perhaps graphically and allows the user to select other options, perhaps by dragging a slider or turning a knob.</dd>
</dl>
</dd>
<dt>field</dt>
<dd>an area provided for a user to enter or edit a value, typically using a keyboard. There are several special fields.
<dl><dt>combo-box</dt>
<dd>a field which is accompanied by a menu of preset values that can be used to quickly enter common or typical values.</dd>
<dt>signature</dt>
<dd>a field for entering a signature.</dd>
<dt>password</dt>
<dd>a field for entering a password. Typically the text is rendered as a set of bullets or boxes to obscure the value.</dd>
</dl>
</dd>
</dl>
<p>
Conforming user agents must support the five generic appearance values: '<span class="value" title="">icon</span>', '<span class="value">window</span>', '<span class="value">button</span>', '<span class="value">menu</span>' and '<span class="property">field</span>'. If a user agent or platform does not support a specific user interface element (e.g. '<span class="value">dialog</span>'), it may apply the values for the respective generic user interface element (e.g. '<span class="value">window</span>').
</p>
<p class="note"><em><strong>Note.</strong>
This specification recommends that user agents allow users to override system appearance and font selections with their own choices or proportions, within the user agent. See the User Agent Accessibility Guidelines, specifically <a href="http://www.w3.org/TR/UAAG10/guidelines.html#gl-user-control-styles">Ensure user control of rendering</a> ([[UAAG10]], section 2 guideline 4).
</em>
</p>
<h3 id="appearance"><span class="property">'appearance'</span> property</h3>
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>appearance</dfn></td></tr>
<tr><th>Value: </th><td>normal | <a href="#appearance-val">&lt;appearance&gt;</a> | inherit</td></tr>
<tr><th>Initial:</th><td>normal</td></tr>
<tr><th>Applies to:</th><td>all elements</td></tr>
<tr><th>Inherited:</th><td>no</td></tr>
<tr><th>Percentages:</th><td>N/A</td></tr>
<tr><th>Media:</th><td>visual, interactive</td></tr>
<tr><th>Computed&nbsp;value:</th><td>specified value</td></tr>
</tbody></table>
<p>This document introduces the <span class="property">'appearance'</span> property which can be used to make an element look like a standard user interface element on the platform.
</p>
<div class="example"><p style="display:none">Example(s):</p>
<h4 class="no-num no-toc">A few <span class="property">'appearance'</span> values demonstrated using HTML4</h4>
<table border="1" id="egappearance">
<thead><tr><th style="width:10em"><span class="property">'appearance'</span></th><th>HTML4 demonstration</th></tr></thead>
<tbody>
<tr><td>normal</td><td><span>hello</span></td></tr>
<tr><td>button</td><td><button>Search</button></td></tr>
<tr><td>push-button</td><td><input type="button" value="Sign up"></td></tr>
<tr><td>hyperlink</td><td><a href="http://www.w3.org/Style/CSS/">CSS home page</a></td></tr>
<tr><td>radio-button</td><td><input type="radio" id="sticky"><label for="sticky">Sticky</label></td></tr>
<tr><td>checkbox</td><td><input type="checkbox" id="giftwrap"><label for="giftwrap">Gift wrap</label></td></tr>
<tr><td>pop-up-menu</td><td><label for="pophoney">Honey</label> <select id="pophoney" size="1">
<option>Water White</option>
<option>Extra White</option>
<option>White</option>
<option>Extra Light Amber</option>
<option>Light Amber</option>
<option selected>Amber</option>
<option>Dark Amber</option>
</select>
</td></tr>
<tr><td>list-menu</td><td>
<label for="listhoney">Honey</label> <select id="listhoney" size="5">
<option>Water White</option>
<option>Extra White</option>
<option>White</option>
<option>Extra Light Amber</option>
<option>Light Amber</option>
<option selected>Amber</option>
<option>Dark Amber</option>
</select>
</td>
</tr>
<tr><td>radio-group</td><td>
<fieldset><legend>tea</legend>
<input type="radio" name="teachoice" id="earl" checked><label for="earl">Earl Grey</label>
<input type="radio" name="teachoice" id="lemon"><label for="lemon">lemon ginger</label>
<input type="radio" name="teachoice" id="green"><label for="green">green tea</label>
<input type="radio" name="teachoice" id="jasmine"><label for="jasmine">jasmine tea</label>
</fieldset>
</td>
</tr>
<tr><td>checkbox-group</td><td>
<fieldset><legend>pizza toppings</legend>
<input type="checkbox" id="freshbasil"><label for="freshbasil">fresh basil</label>
<input type="checkbox" id="freshgarlic"><label for="freshgarlic">fresh garlic</label>
<input type="checkbox" id="freshspinach"><label for="freshspinach">fresh spinach</label>
<input type="checkbox" id="greenpeppers"><label for="greenpeppers">green peppers</label>
<input type="checkbox" id="mushroom" checked><label for="mushroom">mushrooms</label>
<input type="checkbox" id="olives"><label for="olives">olives</label>
<input type="checkbox" id="onions" checked><label for="onions">onions</label>
<input type="checkbox" id="pineapple"><label for="pineapple">pineapple</label>
<input type="checkbox" id="tomatoes" checked><label for="tomatoes">tomatoes</label>
</fieldset>
</td>
</tr>
<tr><td>field</td><td><textarea rows="3" cols="20">Note to self.</textarea></td></tr>
<tr><td>password</td><td><input type="password" value="secret"></td></tr>
</tbody>
</table>
</div>
<h4 class="no-num no-toc"><span class="property">'appearance'</span> property details</h4>
<p>
The <span class="property">'appearance'</span> property is a shorthand for <span class="property">'appearance</span>', <span class="property">'color</span>', <span class="property">'font</span>',
and <span class="property">'cursor</span>'. It sets <span class="property">'appearance'</span> to the specified value and the other
properties to their appropriate system value; '<span class="value">normal</span>' resets
<span class="property">'appearance'</span> to '<span class="value">normal</span>' and the others to '<span class="value">inherit</span>'. The <span class="property">'appearance'</span> property does not affect the specified or computed values of any other
properties.
</p><p>
If <span class="property">'appearance'</span> is not '<span class="value">normal</span>', the UA must render the element as if
it was the specified user interface (UI) control from the platform. The UA should use the
computed values of the <span class="property">'background-*'</span>, <span class="property">'border-*'</span>, <span class="property">'padding-*'</span>,
<span class="property">'outline-*'</span>, and <span class="property">'text-decoration'</span> properties when they do not have
their initial values and the computed values of <span class="property">'color'</span>, <span class="property">'font'</span>, and
<span class="property">'cursor'</span> (whatever their values) to influence the rendering where
possible. Any values from those properties that cannot be used to
influence the rendering of the UI control must not affect the rendering at all.
</p><p class="example">
For example, the UA should not draw a second border around a
UI control that already has a border.
</p><p>
If <span class="property">'background-color'</span> or <span class="property">'background-image'</span> have non-initial values
and the UA is using their values for influencing the rendering of
the UI control, then the UA must ensure that the <span class="property">'color'</span> property is
also used to influence the rendering.
<!--
Similarly if <span class="property">'color'</span> is used to influence the rendering, then <span class="property">'background-color'</span> must be used to influence the rendering, and the other <span class="property">'background-*'</span> properties should be used to influence the rendering as well.
-->
</p><p>
Other properties must not affect the handling of <span class="property">'appearance'</span> and
must instead be applied according to normal CSS rules. In particular
<span class="property">'margin'</span>, <span class="property">'display'</span>, <span class="property">'float'</span>, <span class="property">'height'</span>, <span class="property">'width'</span>, and <span class="property">'line-height'</span>,
are not ignored and affect the element as normal.
</p><p>
This specification does not define the term "platform".
</p><p class="example">
For example, it could be the native graphical rendering engine of
the operating system, or it could be a user-agent-specific skin.
In addition, which of several toolkits to use could also be
decided on an element-by-element basis depending on the values of
the <span class="property">'background-color'</span>, <span class="property">'background-image'</span>, <span class="property">'border-*-style'</span>, and
<span class="property">'outline-style'</span> properties, so that the author styles could be
honored while still honoring <span class="property">'appearance'</span> even though the UA is
unable to influence the rendering of OS native UI controls.
</p>
<p class="note"><em><strong>Note.</strong>
The exact list of properties set by, influencing, and not affected by
<span class="property">'appearance'</span> given in the lists above
may be adjusted based on UA implementor feedback.
</em></p>
<p>Appearance values take into account the user interface state (if any) of the element; thus there is no need for separate values for enabled vs. disabled checkboxes for example.
</p>
<div class="example"><p style="display:none">Example(s):</p>
<h4 class="no-num no-toc">Influencing the color and background-color of a button</h4>
<p>This example demonstrates setting the color and background-color of an element that is set to '<code class="css">appearance:push-button</code>'.
</p>
<h5 class="no-num no-toc">sample CSS:</h5>
<pre><code class="css">
input[type=button] {