यदि आप किसी निर्दिष्ट तत्व के तत्काल बच्चों के सभी तत्वों का चयन करना चाहते हैं, तो बाल चयनकर्ता का उपयोग करें।
div > p
उदाहरण
आप CSS चाइल्ड सिलेक्टर को लागू करने के लिए निम्न कोड को चलाने का प्रयास कर सकते हैं
<!DOCTYPE html>
<html>
<head>
<style>
div > p {
background-color: orange;
}
</style>
</head>
<body>
<div>
<p>Para 1 in the div.</p>
<!-- This is not a Child -->
<span><p>Para 2 in the div.</p></span>
</div>
<p>Para 3 outside the div.</p>
</body>
</html> आउटपुट
