[英]Make height of the children same inside flex-box
我有一個display: flex
的div
display: flex
和兩個孩子div說.left
和.right
。 .left
和.right
的內容大小不同。 我想為孩子們設置相同的身高
這是最小的工作代碼
.container{ display: flex; align-items: center } .left, .right{ width: 50%; } .right{ background: blue; height: 100%; } .left{ background: green; height: 100%; }
<div class="container"> <div class="left"> <span>this dis also should have same width as right div</span> </div> <div class="right"> orem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. </div> </div>
這是提琴的問題
注意 :首選解決方案而不使用position: absolute
會破壞我的實際網站
去除高度:100%; 它將解決此問題.. flexbox將其高度應用於孩子本身。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.