在柔性盒内使儿童的高度相同

时间:2016-09-06 08:07:42

标签: html css flexbox

我有div display: flex和两个孩子说.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>
&#13;
&#13;
&#13;

问题

Fiddle

注意:首选解决方案而不应用position: absolute因为它会破坏我的实际网站

1 个答案:

答案 0 :(得分:2)

移除高度:100%;它将解决问题.. flexbox在儿童身上应用它的高度。