प्रत्येक
तत्व का चयन करने के लिए CSS :nth-last-of-type(n) चयनकर्ता का उपयोग करें जो कि उसके माता-पिता का दूसरा
तत्व है, जो पिछले बच्चे से गिना जाता है।
उदाहरण
आप :nth-last-of-type(n) चयनकर्ता को लागू करने के लिए निम्न कोड चलाने का प्रयास कर सकते हैं:
<!DOCTYPE html>
<html>
<head>
<style>
p:nth-last-of-type(2) {
background: blue;
color: white;
}
</style>
</head>
<body>
<p>This is demo text 1.</p>
<p>This is demo text 2.</p>
<p>This is demo text 3.</p>
<p>This is demo text 4.</p>
<p>This is demo text 5.</p>
</body>
</html>