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...

Related Posts :

  • border border CSS border Property The CSS border property is shorthand CSS for specifying u… Read More...
  • border-X-width border-X-width CSS border-X-width Property The CSS border-left-width, b… Read More...
  • border-width border-width CSS border-width Property The CSS border-width property is… Read More...
  • border-X border-X CSS border-X Property The CSS border-left, border-top, border-right&nb… Read More...
  • clear clear CSS clear Property The CSS clear property is used to clear space for an elemen… Read More...

0 Response to "only-child Selector"

Post a Comment