:first-of-type सेलेक्टर का उद्देश्य
:first-of-type सेलेक्टर पैरेंट के अंदर अपने टाइप के पहले एलिमेंट को टार्गेट करता है। यह टाइप-स्पेसिफिक है।
उदाहरण
<!DOCTYPE html>
<html>
<head>
<style>
p:first-of-type {
background: orange;
}
</style>
</head>
<body>
<p>This is demo text1.</p>
<p>This is demo text2.</p>
</body>
</html>
यह ID 1005062633 के समान आलेख है, केवल शीर्षक में "Role of" जोड़ा गया है।