CSS :only-of-type Pseudo-class
- Pagina precedente :only-child
- Pagina successiva :optional
- Torna alla pagina precedente Manuale di riferimento dei pseudo-classe CSS
Definition and Usage
CSS :only-of-type
The pseudo-class matches any element that is the only child of its parent element of the same type.
Example
Specify styles for any <p>, <li>, and <b> element that is the only child of its parent element of the same type:
p:only-of-type { background-color: red; } li:only-of-type { color: salmon; } b:only-of-type { color: green; }
CSS Syntax
:only-of-type { css declarations; }
Technical Details
Version: | CSS3 |
---|
Browser Support
The numbers in the table specify the first browser version to fully support the pseudo-class.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
4.0 | 9.0 | 3.5 | 3.2 | 9.6 |
- Pagina precedente :only-child
- Pagina successiva :optional
- Torna alla pagina precedente Manuale di riferimento dei pseudo-classe CSS