কোনো এলিমেন্ট যদি অন্য এলিমেন্টের প্রথম চাইল্ড হয় তবে সেটিতে বিশেষ স্টাইল যোগ করতে :first-child সিউডো ক্লাস ব্যবহার করুন।
উদাহরণ
নিচের কোডটি রান করে :first-child সিউডো ক্লাসের ব্যবহার বুঝতে পারেন:
<html>
<head>
<style>
div > p:first-child {
text-indent: 25px;
}
</style>
</head>
<body>
<div>
<p>First paragraph in div. This paragraph will be indented</p>
<p>Second paragraph in div. This paragraph will not be indented</p>
</div>
<p>But it will not match the paragraph in this HTML:</p>
<div>
<h3>Heading</h3>
<p>The first paragraph inside the div. This paragraph will not be effected.</p>
</div>
</body>
</html>