প্রতিটি
উপাদানকে স্টাইল করতে যা তার পিতামাতার প্রথম সন্তান, CSS :first-child নির্বাচক ব্যবহার করুন।
উদাহরণ
আপনি :first-child নির্বাচক −
বাস্তবায়ন করতে নিম্নলিখিত কোড চালানোর চেষ্টা করতে পারেন<!DOCTYPE html>
<html>
<head>
<style>
p:first-child {
background-color: orange;
}
</style>
</head>
<body>
<h1>Heading</h1>
<p>This is demo text.</p>
<div>
<p>This is demo text, with the first child of its parent div.</p>
<p>This is demo text, but not the first child.</p>
</div>
</body>
</html>