কম্পিউটার টিউটোরিয়াল

CSS :nth-last-child(n) সিলেক্টরের ভূমিকা


প্যারেন্টের চাইল্ড হিসেবে থাকা <p> এলিমেন্টগুলো শেষ চাইল্ড থেকে গণনা করে স্টাইল করতে CSS :nth-last-child(n) সিলেক্টর ব্যবহার করুন।

নিচের কোড রান করে :nth-last-child(n) সিলেক্টর ইমপ্লিমেন্ট করুন।

উদাহরণ

<!DOCTYPE html> <html>   <head>     <style>       p:nth-last-child(4) {         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>     <p>This is demo text 6.</p>   </body> </html>

আউটপুট

CSS :nth-last-child(n) সিলেক্টরের ভূমিকা


  1. CSS :only-of-type সিলেক্টরের ভূমিকা

  2. CSS :target সিলেক্টরের ভূমিকা

  3. CSS :root সিলেক্টরের ভূমিকা

  4. CSS :required সিলেক্টরের ভূমিকা