CSS :only-of-type Selector

:only-of-type is a CSS pseudo-selector which matches an element if its parent has no other children of the same type.

The :only-of-type CSS pseudo-class represents an element that has no siblings of the same type.

The :only-of-type selector matches every element that is the only child of its type, of its parent.

:only-of-type {css declarations;}

Example -

If no tag precedes the selector, it will match any tag (e.g. :only-of-type). If another selector precedes it, it will matched based on the type of tag that selector matches. For example .example:only-of-type will behave like p:only-of-type if .example is applied to a paragraph element.