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