E
E
eellazy2016-08-27 17:47:36
css
eellazy, 2016-08-27 17:47:36

How to create equal height columns?

Hello! Google-google eventually came here. Found a solution to this issue with display:table
Needed for bootstrap. Maybe there is some solution.

Block structure

<div class="col-md-6">
контент
</div>
<div class="col-md-6">
контент
</div>

Answer the question

In order to leave comments, you need to log in

5 answer(s)
P
Philipp, 2016-08-27
@zoonman

.row-eq-height {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display:         flex;
}

getbootstrap.com.vn/examples/equal-height-columns

A
archelon, 2016-08-27
@archelon

brm.io/jquery-match-height

O
Oleg, 2016-08-27
@werty1001

<div class="row same-cols">
  <div class="col-md-6 same-height">1</div>
  <div class="col-md-6 same-height">1</div>
</div>

$('.same-cols').each(function(){

  var height = 0,
    cols = $(this).find('.same-height');

    cols.each(function(){
      if( $(this).innerHeight() > height ) height = $(this).innerHeight();
    });  

    cols.css( 'height', height + 'px');
});

If the same height is needed for a design, such as a background, then this can be done through CSS.

V
Viktor Taran, 2016-08-28
@shambler81

depending on what you need, if you need to align the columns in height, then there are several solutions.
All have their pros and cons.
If you need to make the same columns in the product catalog, which happens most often.
Then everything just throw additionally after every second position. дви кол-12
If you need it more difficult when there are 2-3 columns depending on the resolution, then follow the same scheme, but show this div only at this resolution.
Example
mydefile.ru/catalog
From a programming point of view, it's very easy to add an empty div to every second and third product. It does NOT require any zhs or media queries, no crutches. 100% product is visible and it will not crawl away. Cheap and cheerful
If the layout is more complex and height is required, then it is easier to actually set it. But most likely you are talking about a dynamic directory

S
Super Star, 2016-08-28
@3dben

There is a script ruseller.com/adds.php?id=2483&rub=11

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question