html - 使 div 的高度等于 flex 容器中内容的高度
问题描述
如何使子 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>
解决方案
推荐阅读
- aws-lambda - DynamoDB 更新数据有效但返回内部服务器错误
- jquery - 防止点击时触发下拉菜单
- matlab - 在 MATLAB 中实现我自己的 FFT 给出错误的结果
- java - 如何从基于数据库的 Id SpringBoot Java 中获取数据
- mysql - SQL - 我需要显示 2012 年销售的商品名称、商品价格和数量
- c - 使用 fgets() 从另一个 CSV 写入 CSV 并跳过行
- spring - 如何在 SCDF 中设置日志方向
- python - HC-SR04 卡住(Python 和 Raspberry Pi)
- java - 如何在不删除父文件夹的情况下递归删除空目录?
- awk - 在这种情况下需要一些帮助。(Sed 或 Awk)