保持两个div的长度相同 [英] Keeping two div the same length

查看:303
本文介绍了保持两个div的长度相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个div,主要和侧面,我想确保保持长度,以较长者为准。

I have two divs, main and side that I want to ensure stay the length of whichever is longer.

此时,主要部分比侧面长,如何根据内容使它们保持相同的高度?

At the moment, the main is longer than the side, how can I make them stay the same height, depending on the content?

#main{
width:818px;
padding:20px;
float:left;
background-color:white;
border-top-left-radius:20px;
border-left:1px solid #909090;
border-top:1px solid #909090;
}

#side{
float:left;
width:230px;
padding:20px;
background-color:#FEF5CA;
border-top:1px solid #909090;
border-right:1px solid #909090;
}

感谢。

推荐答案

display: table-cell;

CSS3是您的朋友; - )

CSS3 is your friend ;-)

这篇关于保持两个div的长度相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆