Search within TutorialsPark

CSS Pseudo Class Selector :only-of-type


Selects elements that are the sole element of their type defined by their containing element


Definition and Notes.

1. CSS Pseudo Class :only-of-type selects and styles elements that are the only child of a type of their parents.

2. The element may have sibling but none of them should be of same type as itself.

3. Eg: p:only-of-type will select <p> element which is of unique type among its siblings.


Pattern:

CSS :only-of-typePseudo Class selector. internetexplorer safari firefox opera chrome

View in Splitscreen»

Code-Editor:

Note: In above Demo element <p> is unique sibling only within <div>,hence matched.

Related Examples.