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

CSS-এ :first-child সিউডো-ক্লাসের ব্যবহার

কোনো এলিমেন্ট যদি অন্য এলিমেন্টের প্রথম চাইল্ড হয় তবে সেটিতে বিশেষ স্টাইল যোগ করতে :first-child সিউডো ক্লাস ব্যবহার করুন।

উদাহরণ

নিচের কোডটি রান করে :first-child সিউডো ক্লাসের ব্যবহার বুঝতে পারেন:

<html>
  <head>
    <style>
      div > p:first-child {
        text-indent: 25px;
      }
    </style>
  </head>
  <body>
    <div>
      <p>First paragraph in div. This paragraph will be indented</p>
      <p>Second paragraph in div. This paragraph will not be indented</p>
    </div>
    <p>But it will not match the paragraph in this HTML:</p>
    <div>
      <h3>Heading</h3>
      <p>The first paragraph inside the div. This paragraph will not be effected.</p>
    </div>
  </body>
</html>
  1. CSS align-content: space-between মান ব্যবহার

  2. CSS align-items: baseline মান ব্যবহার

  3. CSS align-content: flex-start মান ব্যবহার

  4. CSS-এ :first-child 의사-ক্লাস