如何使2个div继承父div内哪个div具有更高的高度? [英] How to make 2 divs inherit the height of which ever div has higher height inside a parent div?

查看:61
本文介绍了如何使2个div继承父div内哪个div具有更高的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法匹配父div内2 div的高度.我很难解释我是在Jsfiddle上做到的.

I'm having trouble matching the height of 2 divs inside a parent div. It's kinda hard for me to explain to I made it on Jsfiddle.

http://jsfiddle.net/DSQpd/

基本上,我想做的就是匹配高度,而不管哪个更长.我已经尝试过将 height:100%; 放在两个em上,但仍然无法正常工作.

Basically, what I wanted to do is match the height regardless of which on is longer. I've already tried putting height:100%; on both of em but still doesnt work.

谢谢!

推荐答案

删除浮动内容并使用

display: table-cell;

演示

这篇关于如何使2个div继承父div内哪个div具有更高的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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