html css 2列布局,两列相同高度自动? [英] html css 2 column layout, both columns same height automatically?

查看:632
本文介绍了html css 2列布局,两列相同高度自动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个两列布局设置,我想让两个列自动伸展填充两个列的父div,原因是左列有一个背景和边框,我想要它占据整个页面的一面,所以它不会看起来凌乱等。我使用inline-block来对齐两个列,而不是float或任何东西(我不能使用overflow:hidden,因为它弄乱了我的一些可能出来的div,ex:dropdown菜单的功能)所以我需要找到一个简单的方法来做到这一点,使用这种方法。

I have a two column layout set up, and I want to have both columns automatically stretch to fill parent div of the two columns, The reason being that the left column has a background and border to it, and i want it to take up the entire side of the page so it won't look messy and such. I use inline-block to align the two columns, not float or anything (I can't use overflow:hidden because it messes up some of my features that may go out of the div, ex: dropdown menus) So I need to find a simple way to do this, using this method.

jsfiddle:

http://jsfiddle.net/sFBGX/

推荐答案

您可以使用 CSS 表格布局(非HTML表格布局,这将是语义不佳)

You can use CSS table layout (not HTML table layout, that would be poor semantics)

请参阅http://jsfiddle.net/PhilippeVay/sFBGX/2/

兼容性是IE8 +,如果需要,可以备份IE6 / 7与 inline-block

Compatibility is IE8+ and fallback for IE6/7 if needed is exactly the same as for inline-block

完全相同 这里 其中 以及 faux-columns 的旧方法(您的设计必须考虑这种技术)

Longer explanations in previous answers: here and there with also the good old method of faux-columns (your design must be thought with this technique in mind)

这篇关于html css 2列布局,两列相同高度自动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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