我有两个div彼此相邻; (浮动:右) 每个div都有段落; 但每个段落有不同的长度; 这使得一个div 更长而另一个更短;当你调整大小窗口时! 当你调整窗口大小时,如何使div相等? 或者当屏幕较小时,如何让它们在彼此之下对齐?当它很大时它们应该是平等的!
谢谢。
答案 0 :(得分:0)
只需使用flex:
.container {
display: flex;
}
.container>div {
flex: 1;
border: 1px solid;
}
@media all and (max-width:480px) {
.container {
flex-direction: column
}
}

<div class="container">
<div>Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem</div>
<div>Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem m ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem Lorem
ipsuem Lorem ipsuem Lorem ipsuem Lorem ipsuem</div>
</div>
&#13;