Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

only of type

The only-of-type structural pseudo-class selector will target an element if it is the only element of its type in its parent element.
Syntax Logicelement:only-of-type { property_list }

CSS Code Example

<style> p:only-of-type { background: pink; } </style> <div> <p>content...</p> <span>content...</span> </div> <hr /> <div> <p>content...</p> <p>content...</p> </div>

CSS

Selectors

universaltypecompoundclassidnotattributedescendantchildadjacent siblinggeneral siblingfirst childlast childonly childfirst of typelast of typeonly of typenth childnth last childnth of typenth last of typeemptyrootfirst linefirst letterbeforeafterlinkvisitedhoveractivefocustargetenableddisabledcheckedlang