Draft This page is not complete.
This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.
The :state
CSS pseudo-class represents any custom element with the specified custom state in ElementInternals.states
.
custom-element:state(foo) {
/* Styles to apply when `custom-element` is in the `foo` state */
}
Syntax
Syntax not found in DB!
Examples
Fill in a simple example that nicely shows a typical usage of the selector, then perhaps some more complex examples (see our guide on how to add code examples for more information).
my code block
And/or include a list of links to useful code samples that live elsewhere:
- x
- y
- z
Specifications
Specification | Status | Comment |
---|---|---|
UnknownThe definition of 'The :state() selector' in that specification.
|
Unknown | Initial definition. |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
No compatibility data found. Please contribute data for "css.selectors.state" (depth: 1) to the MDN compatibility data repository.
See also
- The
ElementInternals.states
property -DOMTokenList
used to configure which custom states a custom element is in.
:state() by Mozilla Contributors is licensed under CC-BY-SA 2.5.