<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Pseudo Class :only-of-type</title>
<style>
div {
background-color: aqua;
border: 4px solid green;
}
p:only-of-type {
color: red;
background: yellow;
font-style: italic;
}
h2:only-of-type {
color: blue;
font-size: 30px;
}
</style>
</head>
<body>
<h2>:only-of-type -> I am the only child of h2 type under body</h2>
<h3>See this example carefully</h3>
<div class="div1">
<div>1. I am not the only child of the div type.</div>
<p>1. I am not the only child of the paragraph type.</p>
<p>2. I am not the only child of the paragraph type.</p>
<div>2. I am not the only child of the div type.</div>
<div class="div2">
<p>1. I am the only child of the div type under this parent</p>
<div>1. I am the only child of the div type under this parent</div>
</div>
</div>
</body>
</html>