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

CSS flex-direction: column মান ব্যবহার

flex-direction: column মান ফ্লেক্স আইটেমগুলকে লম্বাবত (উপর থেকে নিচে) সাজায়। মেইন অক্ষ লম্বাবত হয়ে যায়।

উদাহরণ

নিচের কোডটি চালিয়ে column মান ব্যবহার দেখুন:

<!DOCTYPE html> <html> 
  <head> 
    <style> 
      .mycontainer { 
        display: flex; 
        flex-direction: column; 
        background-color: orange; 
      } 
      .mycontainer > div { 
        background-color: white; 
        text-align: center; 
        line-height: 40px; 
        font-size: 25px; 
        width: 100px; 
        margin: 5px; 
      } 
    </style> 
  </head> 
  <body> 
    <h1>Quiz</h1> 
    <div class="mycontainer"> 
      <div>Q1</div> 
      <div>Q2</div> 
      <div>Q3</div> 
      <div>Q4</div> 
      <div>Q5</div> 
      <div>Q6</div> 
    </div> 
  </body> 
</html>

ব্যাখ্যা: flex-direction: column সেট করলে আইটেমগুলো কলাম আকারে উপরে থেকে নিচে সাজে। ক্রস-অক্ষ হরিজেন্টাল হয়ে যায়, তাই align-items এখন হরিজেন্টাল এলাইনমেন্ট নিয়ন্ত্রণ করবে।

  1. CSS justify-content: space-between মান ব্যবহার

  2. CSS flex-flow প্রোপার্টি

  3. CSS flex-basis প্রোপার্টি

  4. CSS flex-direction: row-reverse মান ব্যবহার