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

CSS :first-child সিলেক্টরের ভূমিকা


প্যারেন্টের প্রথম চাইল্ড হয়ে থাকা <p> এলিমেন্টগুলো স্টাইল করতে CSS :first-child সিলেক্টর ব্যবহার করুন।

উদাহরণ

নিচের কোড রান করে :first-child সিলেক্টর ইমপ্লিমেন্ট করুন।

<!DOCTYPE html> <html>   <head>     <style>       p:first-child {         background-color: orange;       }     </style>   </head>   <body>     <h1>Heading</h1>     <p>This is demo text.</p>     <div>       <p>This is demo text, with the first child of its parent div.</p>       <p>This is demo text, but not the first child.</p>     </div>   </body> </html>

  1. CSS :hover সিলেক্টরের ভূমিকা

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

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

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