CSS - :default
The :default
CSS pseudo-class represents any user interface element that is the default among a group of similar elements.
Example
:default { background-color: lime; }
...where...
<form method="get"> <p><input type="submit" id="submit1"></p> <p><input type="submit" id="submit2"></p> <p><input type="reset"></p> </form>
This example causes the background color to be lime
for the default submit button in the form.
Syntax
:default <a href="css/value_definition_syntax#curly_braces_(.7b_.7d)" title="Curly braces">{</a> <var>style properties</var> <a href="css/value_definition_syntax#curly_braces_(.7b_.7d)" title="Curly braces">}</a>
Description
The :default
CSS pseudo-class represents any user interface element that is the default among a group of similar elements.
For example, the default button in a set of buttons could be selected using this pseudo-class.
User interface elements that permit multiple selections may have multiple defaults set in order to initially appear with multiple items selected. In that case all defaults can be represented using the :default
pseudo-class.
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 10.0 | 4.0 (2.0) | No support | 10.0 | 5.0 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | 4.0 (2.0) | No support | 10.0 | 5.0 |
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of ':default' in that specification. |
Living Standard | No change. |
HTML5 The definition of ':default' in that specification. |
Recommendation | Defines the semantic regarding HTML and constraint validation. |
Selectors Level 4 The definition of ':default' in that specification. |
Working Draft | No change. |
CSS Basic User Interface Module Level 3 The definition of ':default' in that specification. |
Candidate Recommendation | Defines the pseudo-class, but not the associated semantic. |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/css/:default