only-child Selector

only-child Selector
SS only-child Selector reference
The CSS only-child structural pseudo-class selector ( X:only-child ) is used to target and style an element if it is an only child of its parent element.
CSS CODE EXAMPLE
<!DOCTYPE html>
<style type="text/css">
div p:only-child {
    background: #FCA7E7;
}
</style>
<div>
  <p>content...</p>
  <span>content...</span>
</div>
<hr />
<div>
  <p>content...</p>
</div>
 
content...
content...

content...

0 Response to "only-child Selector"

Post a Comment