简单的等高DIVs没有JavaScript可能? [英] Easy equal height DIVs without JavaScript possible?

查看:101
本文介绍了简单的等高DIVs没有JavaScript可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我主要使用基于表格的布局,但是由于它被认为是过去的不可思议的东西,所以我已经承担了学习基于DIV的布局的任务。

I've worked mostly with table-based layouts up to this point, but since it's considered a no-go thing of the past now I've taken on the task of learning DIV-based layouting.

到目前为止,我最恼人的挑战之一是找出一种方法来获得等高DIV,在所有主流浏览器上工作,不依赖JavaScript,不需要< a href =http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks =nofollow noreferrer>复杂的CSS战术。它让我想知道为什么使用DIVs是执行布局的首选方法,而表允许快速和容易创建等高页面元素。

One of the most annoying challenges so far for me has been figuring out a way to get equal height DIVs that work on all major browsers, doesn't rely on JavaScript and doesn't require complicated CSS tactics. It kinda makes me wonder why using DIVs is the preferred method of doing layouts while tables allow for the quick and easy creation of equal-height page elements.

我的选项是什么?如果没有完美的方式,你会建议用jQuery做它吗?我想将此技术应用到侧边栏,您可以在此处查看。 (这是我正在开发的主题的测试环境。)

What are my options? If there's no perfect way, would you recommend doing it with jQuery? I'd like to apply this technique to the sidebar that can be viewed here. (This is a test environment for a theme I'm developing.)

更新:预先不知道列的高度;

Update: the height of the columns is not known beforehand; it depends on how much content it should be able to fit.

推荐答案

根据我所知,没有完美的方式。这是CSS的弱点之一。

There is no perfect way as far as I know, and this is one of the weak points of CSS.

然而,在你的情况下,你可以使用伪列技术

In your case, however, you may be able to work with the Faux Columns technique.

这篇关于简单的等高DIVs没有JavaScript可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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