Chỉnh cột same height bằng css

 Chào các bạn,

Dưới đây là một trong những cách chỉnh same height bằng css

Bạn tham khảo link này nhé:

Demo: https://codepen.io/ondrejsvestka/pen/gWPpPo

HTML ví dụ:

<body>

  <div class="container">

    <h1>Same height columns in Bootstrap</h1>

    <div class="row row-flex">

      <div class="col-md-4 col-sm-6 col-xs-12">

        <div class="content colour-1">

          <h3>First column</h3>

          <p>This one has a bit longer content</p>

          <p>This one has a bit longer content</p>

        </div>

      </div>

      <div class="col-md-4 col-sm-6 col-xs-12">

        <div class="content colour-2">

          <h3>Second column</h3>

          <p>Normal content.</p>

        </div>

      </div>

      <div class="col-md-4 col-sm-6 col-xs-12">

        <div class="content colour-3">

          <h3>Third column</h3>

          <p>Normal content.</p>

        </div>

      </div>

      <div class="col-md-4 col-sm-6 col-xs-12">

        <div class="content colour-4">

          <h3>Fourth column</h3>

          <p>Normal content.</p>

        </div>

      </div>

      <div class="col-md-4 col-sm-6 col-xs-12">

        <div class="content colour-5">

          <h3>Fifth column</h3>

          <p>Normal content.</p>

        </div>

      </div>

      <div class="col-md-4 col-sm-6 col-xs-12">

        <div class="content colour-6">

          <h3>Sixth column</h3>

          <p>Normal content.</p>

        </div>

      </div>

    </div>

    

    <p class="text-muted">This pen is a part of the <a href="https://bootstrapious.com/p/bootstrap-tips-and-tricks" target="_blank">Bootstrap tips and tricks article</a>.</p>

    

  </div>

</body>


==========

CSS:

/* display this row with flex and use wrap (= respect columns' widths) */


.row-flex {

  display: flex;

  flex-wrap: wrap;

}



/* vertical spacing between columns */


[class*="col-"] {

  margin-bottom: 30px;

}


.content {

  height: 100%;

  padding: 20px 20px 10px;

  color: #fff;

}



/* Demo backgrounds and styling*/


.colour-1 {

  background: #483C46;

  color: #fff;

}


.colour-2 {

  background: #3C6E71;

}


.colour-3 {

  background: #70AE6E;

}


.colour-4 {

  background: #82204A;

}


.colour-5 {

  background: #558C8C;

}


.colour-6 {

  background: #917C78;

}


body {

  padding: 20px 0;

  font-family: Roboto, sans-serif;

}


.content h3 {

  margin-top: 0px;

  font-weight: 300;

}


h1 {

  font-weight: 300;

  margin-bottom: 40px;

}


Kết quả:






Nhận xét

Bài đăng phổ biến từ blog này

Khôi phục phân vùng ổ cứng do ghost nhầm theo Hieuit.net

Cách sử dụng 2 phương thức [httppost] và [httpget] trong MVC theo https://dzungdt.wordpress.com

MVC định dạng tiền tệ vnđ - Format currency vnd in MVC