GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing drafts.csswg.org (truncated) — CSS Basic User Interface Module Level 4 1. IntroductionThis module describes CSS properties which enable authors to style user interface related properties and values. Section 2.1 of CSS1 [CSS1] and Chapter 18 of CSS2 [CSS21] introduced several user interface related properties and values. User Interface for CSS3 (16 February 2000) introduced several new user interface related features. [CSS-UI-3] was later introduced to incorporate, extend, and supersede these. This specification continues this work, and in turn replaces [CSS-UI-3]. 1.1. PurposeThe purpose of this specification is to achieve the following objectives:
2. Module InteractionsThis document defines new features not present in earlier specifications. In addition, it replaces and supersedes [CSS-UI-3], which itself replaced and superseded the following:
Note: The box-sizing property was previously defined in this section of the specification, but has been moved to CSS Sizing 3 § 3.3 Box Edges for Sizing: the box-sizing property. Note: The text-overflow property was previously defined in this section of the specification, but has been moved to CSS Overflow 3 § 5.1 Overflow Ellipsis: the text-overflow property. 2.1. Value DefinitionsThis specification follows the CSS property definition conventions from [CSS21] using the value definition syntax from [CSS-VALUES-3]. Value types not defined in this specification are defined in CSS Values & Units [CSS-VALUES-3]. Combination with other CSS modules may expand the definitions of these value types. In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the CSS-wide keywords as their property value. For readability they have not been repeated explicitly. 3. Outline propertiesAt 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:
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 Appendix E of CSS 2.1 [CSS21]. 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-visible state, thus authors must not make the outline invisible on such elements without making sure an alternative highlighting mechanism is provided. The rendering of applying transforms to outlines is left explicitly undefined. Tests
3.1. Outlines Shorthand: the outline property
Tests
The outline property is a shorthand property and sets all three of outline-style, outline-width, and outline-color. In the ambiguous case where a lone auto value is specified, or if auto is specified together with an <'outline-width'> value, but without an explicit <'outline-style'> or <'outline-color'> value, both outline-style and outline-color are set to auto. Note: The shorthand purposefully omits the outline-offset property, which determines the position rather than the appearance of the outline, so that it can cascade independently, as well as for backwards compatibility reasons. 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 border edge, it should follow the border-radius curve, as well as the corner-shape. The position of the outline may be affected by descendant boxes. The dimensions of the drawn outline contribute to the ink overflow area of an element. 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. Note: The outline is the same on all sides. In contrast to borders, there are no outline-top, outline-left, etc. properties. This specification does not define how multiple overlapping outlines are drawn or how outlines are drawn for boxes that are partially obscured behind other elements.
Here’s an example of drawing a thick outline around a BUTTON element:
Graphical user interfaces may use outlines around elements to tell the user which element on the page has the focus. These outlines are shown 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).
For example, to draw a thick black line around elements in the
:focus-visible state, and a thick red line when it is in the
:active state, the following rules can be used:
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. 3.2. Outline Thickness: the outline-width property
TestsThe outline-width property accepts the same values as border-width (CSS Backgrounds 3 § 3.3 Line Thickness: the border-width properties), with the same meaning. 3.3. Outline Patterns: the outline-style property
<outline-line-style> accepts the same values as <line-style> (CSS Backgrounds 3 § 3.2 Line Patterns: the border-style properties) with the same meaning, except that hidden is not a legal outline style. In addition, the outline-style property accepts the value auto. The auto value permits the user agent to render a custom outline style, typically a style which is either a user interface default for the platform, or perhaps a style that is richer than can be described in detail in CSS, e.g. a rounded edge outline with semi-translucent outer pixels that appears to glow. User agents may enable authors to influence the rendering of auto style outlines via the outline-color property, but this specification does not define how the rendering is impacted (if at all). The outline-width property is ignored when outline-style is auto. User agents may treat auto as solid. Tests
3.4. Outline Colors: the outline-color property
Tests
The outline-color property accepts all values of <'border-top-color'>, as well as the following keywords:
See CSS Color 4 § 15. Resolving <color> Values for the computed value of <color> values, and CSS Images 4 § 4 1D Image Values: the <image-1D> type and stripes() notation for <image-1D> values.
Earlier versions of this specification had an additional
invert value,
performing a color inversion on the pixels on the screen.
This is no longer supported,
and was removed for lack of implementations
(and of intent to implement)
in modern user agents.
See CSS User Interface 3 § 4.4 Outline Colors: the outline-color property for details.
3.5. Offsetting the Outline: the outline-offset propertyBy default, the outline is drawn starting just outside the border edge. However, it is possible to offset the outline and draw it beyond the border edge.
Tests
If the computed value of outline-offset is anything other than 0, then the outline is outset from the border edge by that amount.
For example,
to leave 2 pixels of space between a focus outline
and the element that has the focus or is active,
the following rule can be used:
Negative values must cause the outline to shrink into the border box. Both the height and the width of the 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. 4. ResizingCSS2.1 provides a mechanism for controlling the appearance of a scrolling mechanism (e.g. scrollbars) on block container elements. This specification adds a mechanism to that for controlling user resizability of elements as well as the ability to specify text overflow behavior. 4.1. Resizing Boxes: the resize propertyThe resize property allows the author to specify whether or not an element is resizable by the user, and if so, along which axis/axes.
Tests
Currently it is possible to control the appearance of the scrolling mechanism (if any)
on an element using the overflow property
(e.g. 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 that are scroll containers. UAs may also apply it, regardless of the value of the overflow property, to:
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 Interface CSSPseudoElement. 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 style attribute 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 in which user attempts to resize an element appear to be overridden or ignored, e.g. because of !important cascading declarations that supersede that element’s style attribute width and height properties in the DOM. Changes to the computed value of an element’s resize property do not reset changes to the style attribute made due to user resizing of that element.
For example,
to make iframes scrollable and resizable,
the following rule can be used:
5. Pointing Devices and Keyboards5.1. Pointer interaction5.1.1. Styling the Cursor: the cursor property
Tests
This property specifies the type of cursor to be displayed for the pointing device when the cursor’s hotspot is within the element’s border edge. Note: As per CSS Backgrounds 3 § 4.1 Curve Radii: the border-radius properties, the border edge 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 special handling of image maps for the cursor property. Values have the following meanings:
Here is an example of using several cursor values.
This example sets the cursor on all hyperlinks (whether visited or not) to an external SVG image to be used as a cursor. If that fails to load, user agents 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 cannot load any of those image cursors, the UA would skip to the last value and render the pointer cursor. 5.1.1.1. Predefined CursorsThe <cursor-predefined> production encompasses a broad selection of predefined cursors, present on most operating systems. Its syntax is: <cursor-predefined> = auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | grab | grabbing | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out The <cursor-predefined> keywords have the following meanings and likely renderings:
5.1.1.2. Cursor of the canvasThe document canvas is the infinite surface over which the document is rendered [CSS21]. 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. 5.2. Insertion caretThe insertion caret (or “caret” for short) is a visible indicator of the insertion point in an element that accepts text input, where text (and potentially other content) can be inserted by the user. The caret-color, caret-animation, and caret-shape properties give the author some amount of control over the appearance of the caret. Text or elements are considered to accept text input
if they are either an editable element or a descendent thereof,
excluding any such element where the used value of user-select is none,
as well as subtrees rooted at an HTML element with a Some user agents have other user interface mechanisms with a similar appearance, also occasionally referred to 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. The caret-color, caret-animation, and caret-shape properties are not intended to apply to such mechanisms nor outside of editable elements, though user agents may choose to take them into account. Whether to do so and to what extent is up to the user agent. Note: The cursor image shown when hovering over text when the cursor property is auto, or when hovering over an element where the cursor property is text or vertical-text, though it sometimes resembles a caret, is not a caret (it’s a cursor). Within the context of this section, character is to be understood as extended grapheme cluster, as defined in [UAX29], and visible character means a character with a non-zero advance measure. 5.2.1. Coloring the Insertion Caret: the caret-color property
Tests
This property controls the color of the insertion caret. It takes one or two values. The first value has the following effects:
The second value has no effect when caret-shape is bar, underscore,
or auto behaving as either of these values.
If caret-shape is block—or auto behaving as block—then it determines the color of the text overlapping the caret.
If the second value is omitted,
the behavior is the same as if
Text considered to overlap the caret is the next visible character after the insertion point, if any.
This illustrates the effect of the second value of caret-color on block carets.
In each of the sample renderings below,
the insertion point is between the letters u and m.
Optionally, user agents may treat as overlapping only those parts of next visible character which visually intersect with the block, and adjust the color of those parts only. 5.2.2. Animation of the insertion caret: caret-animation
On most platforms and in most UAs, the insertion caret blinks. This property allows the author to take control over the way the caret is animated.
Note: It is recommended for authors to stop the caret from blinking or fading using caret-animation: manual when applying custom animations using [CSS3-ANIMATIONS], to prevent the UA’s animation and the CSS animation to interfere. Note: See Guideline 2.3: Seizures: Do not design content in a way that is known to cause seizures [WCAG20].
A user who is disturbed by or has adverse reactions to blinking or flashing visuals
may want to make all carets static and non-blinking,
regardless of platform defaults or author settings.
This can be accomplished with the following rule in the user stylesheet.
UAs that do not have an editable user stylesheet should provide a setting to disable blinking, flashing, and animated carets. UAs that do have an editable user stylesheet may want to provide this setting as well. See [WCAG] Guideline 2.2 and Guideline 2.3 for details.
Typically, the caret blinks on and off.
This makes it alternate between 2 colors.
The simulated rendering below illustrates how this is expected to look.
Text area
with color-alternating caret
Focus the element below to see how your browser renders it. Text area with color-alternating caret
If a user agent is unwilling to yield control of caret animations
to page authors and would not honor caret-animation: manual,
it must not implement the property at all.
Note:
This enables authors to use 5.2.3. Shape of the insertion caret: caret-shape
Tests
This property allows authors to specify the desired shape of the insertion caret.
The width of the block and underscore carets should be the advance measure of the next visible character after the insertion point, or 1ch if there is no next visible character or if this information is impractical to determine. When determining the orientation and appearance of the caret,
UAs must take into account the writing mode [CSS-WRITING-MODES-3]
and must apply transformations [CSS-TRANSFORMS-1].
If the edited text is laid out on a path,
for instance by using the SVG The thickness of bar and underscore carets—as well as that of auto carets with a similar rendering—is determined by the user agent. When practical, the user agent should choose a thickness that ensures the caret remains visible even if it has been scaled down via means such as transformations [CSS-TRANSFORMS-1]. When there is not enough room at the end of a line to display the caret positioned there, the user agents should still display it, even if that means means painting past the bounds of the scrollable overflow area; user agents may impose limits on this and clip as necessary. User agents may also visually reposition a caret in order to display it within the scrollport if it would otherwise be invisible. The stacking position of the caret is left undefined within the following constraints:
This illustrates the typical appearance of the various caret shapes.
In each of the sample renderings below,
the insertion point is between the letters u and m.
underscore or block carets are commonly used
in terminals and command lines,
as in this example.
The simulated rendering below illustrates how this is expected to look. user@host:css-ui-4 $ ls -a
. .. Overview.bs Overview.html
user@host:css-ui-4 $
Focus the element below to see how your browser renders it. user@host:css-ui-4 $ ls -a . .. Overview.bs Overview.html user@host:css-ui-4 $ 5.2.4. Insertion caret shorthand: caret
This property is a shorthand for setting caret-color, caret-animation, and caret-shape in one declaration. Omitted values are set to their initial values.
This example illustrates using the various caret-related properties
in combination.
They are used here to simulate the appearance of the caret
on an old phosphor computer monitor.
The simulated rendering below illustrates how this is expected to look. >
Focus the element below to see how your browser renders it. >
5.3. Keyboard control5.3.1. Directional Focus Navigation: the nav-up, nav-right, nav-down, nav-left properties
Tests
User agents for devices with directional navigation keys respond by navigating the focus according to four respective nav-* directional navigation properties (nav-up, nav-right, nav-down, nav-left). This specification does not define which keys of a device are directional navigational keys. Note: Typical personal computers have keyboards with four arrow keys. One possible implementation would be to use those four arrow keys for directional navigation. For accessibility and user convenience, user agents should allow configuration of which keys on a keyboard are used for directional navigation. 5.3.1.1. Example: positioned buttonsHere is an example of buttons positioned in a diamond shape whose directional focus navigation is set in such a way to navigate the focus clockwise (or counter-clockwise) around the diamond shape when the user chooses to navigate directionally.
Whatever markup sequence the buttons may have (which is not specified in this example) is irrelevant in this case because they are positioned, and yet, it is still important to ensure focus navigation behaviors which relate reasonably to the specified layout. 5.3.1.2. Example: moving focus to inside a frameMoving the focus to an element in a specific frame requires both the element’s id and the frame’s name. This example shows how to make navigating left from the button with id "foo" move the focus to the element with id "bar" within the frame named "sidebar".
5.3.2. Obsolete: the ime-mode propertyime-mode is a property somewhat implemented in some browsers that is problematic and officially obsoleted by this specification and its predecessor [CSS-UI-3]. User agents should not support the ime-mode 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: 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.
Note: there are several [HTML5] features which authors should use
to provide information to user agents that allow them to provide a better input user experience:
6. User Interaction6.1. Controlling content selectionThe user-select property enables authors to specify which elements in the document can be selected by the user and how. This allows for easier interactions when not all elements are equally useful to select, avoiding accidental selections of neighboring content.
Tests
User agents must not apply the user-select property to the ::first-line and ::first-letter pseudo-elements. Note: The UA may apply this property to the ::before and ::after pseudo-elements. If it does, the auto value maps to a used value of none on these pseudos, but other values can be specified. This preserves the legacy behavior of generated content not being selectable or copyable, which is appropriate when these pseudos are used for decorative purposes. However, this property allows them to become selectable and copyable, as the user would expect in cases where they are used to generate parts of the content, such as the issue numbers in this document. To the extent possible, authors should avoid using generated content for non-decorative purposes, and should prefer including all the content in the DOM. This feature is at risk. if we allow user-select to change to a value other than none, we need to figure out what this means for copyability and DOM APIs. When generated content in pseudo-elements becomes selectable through this mechanism, UAs should also make this content findable through their search function. Should it also apply to ::marker? To page-margin boxes? Should the used value of auto also be none, or would text be more appropriate? The used value is the same as the computed value, except:
For the purpose of this specification,
an editable element is either
an editing host
or a mutable form control with textual content,
such as Should there be constraints on what happens to the used value on elements that are editable descendants of editing hosts? The semantics are not obvious. Maybe none should map to text, or maybe all values should map to text.
Note: Selections can include more than just text and extend over images, tables, videos, etc. The behavior when copying and pasting such selections is out of scope for this specification. The following additions are made to the UA stylesheet for HTML:
the list above is incomplete and needs to include
at least the various button-like variants of For compatibility with legacy content, UAs that support user-select must also support -webkit-user-select as an alias. Note: The details of the aliasing mechanism is intentionally left up to the UA. Making -webkit-user-select a shorthand property of user-select is known to be an effective approach, and new implementers should consider it. However, UAs supporting -webkit-user-select as an alias of user-select through other means exist without adverse consequences to compatibility, so this specification allows flexibility. 6.2. Exclusion from Hit-testing: the pointer-events propertyWhile this property modifies the normal behavior of hit-testing, this normal hit-testing is currently not specified. There is broad interoperability about the seemingly obvious parts of this problem, but there are countless nuances and corner cases that would greatly benefit from a detailed specification. The CSS-WG would hugely appreciate help with writing such a specification.
TestsThe pointer-events property defines whether an element’s boxes can be targeted by point pointer events. Values have the following meanings:
pointer-events: none does not inhibit sequential focus navigation. Note: This pointer-events: none only excludes the element itself from hit-testing, not the whole subtree. While this property propagates to descendants via inheritance, pointer-events: auto can be specified on a descendant of a pointer-events: none element, and such an element will participate normally in hit-testing. Note: Events that target a pointer-events: auto descendant of a pointer-events: none element can still be caught by event handlers on pointer-events: none ancestors of the targeted element during the bubbling or capturing phases (see DOM § 2 Events). Note: SVG 2 § 15.6 The ‘pointer-events’ property defines a variant of this property for SVG elements, with more possible values. The effect of such values outside of SVG is currently not defined. 6.3. Preventing All Interaction: the interactivity property
Tests
The interactivity property specifies whether an element and its flat tree descendants (including text nodes) are inert or not.
When an element or text node is inert:
User agents may allow the user to override the restrictions on find-in-page and text selection. Note: This property allows an author to force an element inert, but doesn’t allow making an element *non*-inert, just deferring inertness to the host language. For example, in HTML, while a modal dialog is being displayed, the rest of the page is forced inert automatically, regardless of the value of this property. In general, host languages can make use of more information about the document than CSS has easy access to to determine what the best inertness behavior is for users. Note: Inert nodes generally cannot be focused,
and user agents do not expose the inert nodes
to accessibility APIs or assistive technologies.
An inert subtree should not contain any content or controls
which are critical to understanding or using aspects of the page
which are not in the inert state.
Content in an inert subtree will not be perceivable by all users, or interactive.
Authors should not specify elements as inert
unless the content they represent are also visually obscured in some way.
In most cases,
authors should not specify the inert attribute on individual form controls.
In these instances, the
The following should be inserted into the HTML stylesheet,
to ensure that top-level modal dialogs become uninert by default:
The dialog:modal selector above needs to be expanded for any other elements that escape inertness by default. 6.4. User Interest Delay: the interest-delay-* properties
Some host language features
can be activated when a user shows interest in an element.
Exactly what this means is up to the host language and user agent
(for example, the HTML For example, if "interest" can be shown by hovering the cursor over an element, briefly passing the cursor over the element while moving the cursor over the page should not (at least by default) indicate "interest"—that could result in UI confusingly popping up and disappearing while the user is performing unrelated tasks. Similarly, once interest has been shown, the interest source should not (at least by default) lose interest instantaneously either. Again, as an example, if the user shows interest in a link by hovering the cursor over it, causing a child popup list to appear next to it, moving the cursor from the link to the popup likely involves briefly leaving both the link and the list, but shouldn’t cause the list to "lose interest" and close the popup. The interest-delay shorthand, and its interest-delay-start and interest-delay-end longhands, allow control of the interest start delay and interest end delay for these features on a given element. Its possible values are:
The interest-delay shorthand sets interest-delay-start to its first value, and interest-delay-end to its second value (or to the first value, if only one value is passed). Note: In the future, the syntax of these properties might be expanded to allow for customizing the delay depending on feature and how the user is showing interest. (For example, providing different delays for hovering vs long-pressing.) 7. Styling Widgets7.1. Widget Accent Colors: the accent-color property
Tests
User interface controls on any given platform are typically designed as a cohesive set, under a single, cohesive visual style. On many platforms (though not all), the visual style includes the use of an accent color, a typically bright color that contrasts markedly with the more utilitarian background and foreground colors. Not every control uses the accent color in every state, but it is nonetheless a core part of the controls’ color scheme. The accent-color CSS property allows the author to specify the accent color for user-interface controls generated by the element. Values have the following meanings:
The UA should use the specified accent-color to draw whichever parts of the element’s control(s) would have otherwise been styled with an accent color. The UA must maintain contrast for legibility of the control, and in order to do so may adjust the luminance or brightness of the color or make color substitutions in other parts of the control (e.g. switching an overlaid glyph from using color to using background-color). It may also generate variations of the color for gradients etc. to match the control to platform conventions for the use of the accent color.
A radio button is typically composed of a circle,
potentially overlaid by a “dot” representing the checked state.
Certain visual styles use an accent color for the checked state:
some of these use it for the background of the circle,
others for its foreground.
In both cases, the accent-color property styles the affected parts of the control. For visual styles that do not use an accent color for radio buttons, accent-color will have no effect. The following are all examples of radio buttons conformantly rendered with a blue accent-color:
If the color supplied is partially or fully transparent, the user agent must first pre-compose it over the Canvas system color and use the resulting (now opaque) color as the accent color. Note: Although it may vary based on user settings, Canvas is typically white when in a light color scheme and black when in a dark color scheme. 7.2. Switching appearance: the appearance property
Tests
While the way most elements in a document look can be fully controlled by CSS, widgets are typically rendered by UAs using native UI controls of the host operating system, which can neither be replicated nor styled using CSS. The term widget in this specification denotes replaced elements that can have native appearance, meaning that they are rendered like analogous native widgets or controls of the host operating system or platform, or with a look and feel not otherwise expressible in CSS. It is up to the host language (e.g., HTML [HTML]) to define which elements can have native appearance. This specification introduces the appearance property to provide some control over this behavior. In particular, using appearance: none allows authors to suppress the native appearance of widgets, giving them a primitive appearance where CSS can be used to restyle them. Using appearance: base gives widgets a base appearance. Widgets in base appearance have their native appearance suppressed where CSS can be used to restyle them, just like primitive appearance, but also have default styles which are usable and interoperable. This is unlike primitive appearance which can cause some widgets to disappear completely. A widget can have some style sheet associated with it and those styles can change based on whether the widget has a base appearance. Native appearance and primitive appearance should have the same styles. appearance:base is not ready to ship until its stylesheet has been fully defined in the HTML specification, and implemented accordingly for all HTML form controls. Note on the history of this featureThis previously existed in prefixed form in most browsers. Before standardization, in addition to none, the possible values were a very long list of all the ways an element could look; each value being responsible for giving form controls their specific look and feel. This list was different across browsers. The CSS Working Group concluded this was impractical to standardize, in part because many values applied to pseudo-elements that other browsers don’t have, as they construct form elements differently, and which should not be standardized, since the ability to make form controls look substantially different on different platforms should be preserved. Also, the ability to turn any arbitrary element (including any form control) into any (other) arbitrary form control is considered a misfeature. Instead, the design being specified is based on just having an "auto" value that makes form controls look like whatever they need, and a "none" value that suppresses native appearance. However, there is evidence that this alone is not web compatible, due in part to uses such as:
The design specified here is a compromise between the two, preserving the simplicity of the none | auto model while maintaining compatibility with existing content via a few additional keywords. The precise list of keywords needed for compatibility and their exact behavior is likely to be refined in a future version of this specification to better handle compatibility with existing content. The CSS-WG welcomes relevant feedback.
The values
slider-vertical and sliderthumb-vertical
are supported in some user agents to change the orientation of
elements.
These values are not specified because changing the orientation of this control
is better done with a separate mechanism.
See issue whatwg/html#4177.
An author wanting to customize the look and feel of check boxes in HTML could use the following:
User agents may disregard some CSS properties used to size and paint the contents of widgets rendered with their native appearance to ensure that the intended appearance is preserved, or because these properties may not be meaningful for the chosen appearance. Disregarding a property means that the user agent treats it as if it didn’t apply to the widget in question. Nevertheless, unless an explicit exception is specified (for compatibility reasons), the user agent must still determine the computed value of any disregarded property according to the usual rules. In more detail, the rules for disregarding properties for natively rendered widgets are:
Some user agents respect the border and padding CSS properties for a <select> rendered with native appearance, but
not for <input type=checkbox>.
Native rendering of widgets may overflow the size of its box if its intrinsic sizing exceeds that size. For compatibility with legacy content, UAs must also support -webkit-appearance as a legacy name alias of appearance. 7.2.1. Properties Disabling Native AppearanceCertain properties, when declared in the Author Origin, will disable the native appearance of certain widgets. Specifically, if all the declarations of the Author Origin pertaining to such a widget are cascaded and a cascaded value exists—after having rolled back any number revert or revert-layer values—for any property that disables native appearance for widgets, then that widget is rendered as a devolved widget. The rendering of a devolved widget is identical to that of the widget in its primitive appearance, except when specified otherwise by the host language. The host language defines which elements represent devolvable widgets. Widgets whose appearance remains native regardless of any properties that disable native appearance for widgets are called non-devolvable widgets. The properties that disable native appearance for widgets are:
Tests
|