प्रत्येक
तत्व को स्टाइल करने के लिए CSS :only-of-type चयनकर्ता का उपयोग करें जो कि उसके माता-पिता का एकमात्र
तत्व है।
उदाहरण
आप :only-of-type चयनकर्ता को लागू करने के लिए निम्न कोड चलाने का प्रयास कर सकते हैं
<!DOCTYPE html>
<html>
<head>
<style>
p:only-of-type {
background: orange;
color: white;
}
</style>
</head>
<body>
<div>
<p>This is demo text 1.</p>
</div>
<div>
<p>This is demo text 2.</p>
<p>This is demo text 3.</p>
<p>This is demo text 4.</p>
</div>
</body>
</html>