<!DOCTYPE html>
<html lang="en-US">
<head>
<style>
p:only-of-type{
color: red;
}
div{
border: 1px solid #8c8c8c;
margin:15px 0;
}
</style>
</head>
<body>
<h1>CSS :only-of-type Selector</h1>
<p>I'm only p of body (direct child of body).</p>
<div>
<a href="/js">Learn JavaScript</a>
<p>I'm only p of div (direct child of this div).</p>
</div>
<div>
<p>I'm first p of my parent (div).</p>
<p>I'm second p of my parent (div).</p>
</div>
</body>
</html>