2列,左动态高度,右与左相同的高度

时间:2019-05-12 01:37:31

标签: html css responsive-design

我有此设置,我想将wrap div设置为左div的高度。右div将比左div具有更多或更少的内容,但它始终需要与左div相同的高度。可以不用javascript吗?

.wrap {
  max-width: 600px;
  background: #ccc;
}

.left {
  width: 300px;
  background: red;
  float: left;
}

.right {
  background: blue;
  overflow:hidden;
  
}
<div class="wrap">
  <div class="left">
    this is dinamic height<br> this is dinamic height<br> this is dinamic height<br> this is dinamic height<br> this is dinamic height<br> this is dinamic height<br>
  </div>
  <div class="right">
    this needs to be the same heigth as left div<br><br>
    
    Right div will have more or less content than left div but it always needs to be the same height as left div. Maecenas vehicula, leo eu commodo aliquam, sem dolor iaculis eros, vel mollis sem urna ac sapien. Integer mattis dui ut erat. Phasellus nibh magna, tempor vitae, dictum sed, vehicula sed, mauris. In enim arcu, porta vel, dictum eu, pretium a, ipsum. Donec cursus, lorem ac posuere viverra, sem tellus accumsan dolor, vel accumsan tortor est et est. 

  </div>
</div>

0 个答案:

没有答案
相关问题