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