Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<style> 
p:only-of-type {
  background-color: red;
}
li:only-of-type {
  color: salmon;
}
b:only-of-type {
  color: green;
}
</style>
</head>
<body>
<h1>Demo of :only-of-type</h1>
<div>
  <p>This is a paragraph in a div.</p>
</div>
<div>
  <p>This is paragraph 1 in a div.</p>
  <p>This is paragraph 2 in a div.</p>
</div>
<p>Here are some <b>bold text</b>.</p>
<p>Here are some lists:</p>
<ul>
  <li>First list item</li>
</ul>
<ol>
  <li>First list item</li>
  <li>Second list item</li>
  <li>Third list item</li>  
</ol>
</body>
</html>