Make two div elements have the same height

1. Get the maximum height after getting their height, and then assign

 var $divClass = $('.className');
 var height = 0;
  $divClass.each(function () {
      if ($(this).height() > height) {
          height = $(this).height();
      }
  });
  $divClass.height(height);

2. Using the adaptive feature of table, each div is a td, and the td must be of equal height;

.wrapper{
    display: table;
    border-spacing: 20px;  /* td间的间距*/
}

.wrapper > div {
    display: table-cell;
    width: 1000px;         /*设置很大的宽度,table自动平分宽度 */
    border-radius: 5px;    /*这里设置圆角就正常了*/
}

3. Add a parent element to them and set display to flex layout;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325568516&siteId=291194637