使div的高度等于flex容器中内容的高度

时间:2018-10-06 21:00:19

标签: html css css3 flexbox

如何使子div的高度仅与内容(在这种情况下为文本)一样长?

.wrapp{
  display:flex;
  flex-direction: row;
  flex-wrap: wrap;
  height: 1200px;
}

.child{
  border: 1px solid red;
  width: 50px;
  height: auto;
  margin: 20px
}
<div class='wrapp'>
<div class='child'>text text text texttext texttext texttext texttext texttext texttext texttext texttext texttext text</div>
<div class='child'>text texttext text</div>


</div>

0 个答案:

没有答案