IE6 CSS显示:表修复? [英] IE6 CSS display:table fix?

查看:90
本文介绍了IE6 CSS显示:表修复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用一个网络应用程序...不幸的是,它必须与最糟糕的软件工作,是ie6。


I'm working on a web app... unfortunately it has to work with the worst piece of software ever written, yes ie6.

我真的很喜欢CSS display:table display:table-cell 属性, 't work in ie。

I really like the CSS display:table and display:table-cell properties, but of course it doesn't work in ie.

有没有人找到任何修复?我一直在寻找,但没有找到任何东西。

条件CSS,.htc文件,javascript ...什么?

我真的想避免使所有的浮动和清除

Has anyone found any fixes for this? I have been looking, but haven't found anything.
Conditional CSS, .htc files, javascript...anything?
I would really like to avoid making everything with floats and clears

推荐答案

很抱歉。没有修复,使IE6支持CSS display:table 。在IE6中实现这个布局的唯一方法是使用< table> 元素。

Sorry. There isn't a fix to make IE6 support CSS display:table. The only way to acheive this layout in IE6 is to actually use <table> elements.

你真的需要支持IE6吗?如果你可以简单地放弃对它的支持,你会解决自己一大堆问题,包括这一个。 IE6的当前全球使用率低于3%,在大多数发达国家甚至更低。

First question: do you really need to support IE6? If you can simply drop support for it, you'll solve yourself a whole ton of problems, including this one. Current global usage of IE6 is below 3%, and even lower in most developed countries.

如果你仍然需要支持IE6,那么你最明显的解决方案就是swallow your semantic markup pride and just use a < table> 标签。

If you do still need to support IE6, then your most obvious solution is simply to swallow your semantic markup pride and just use a <table> tag.

下一个最佳解决方案是使用 display:inline-block;

As described by @Tom, the next best solution is to write your layout using display:inline-block;.

inline-block 允许你将你的元素定义为块,但仍然保留在文本流中(类似于< img> 默认工作)。如果你把它和固定的元素宽度结合起来,而且wapper divs在行周围,你可以使用类似于一个表,虽然它可能很难让它动态扩展页面宽度。

inline-block allows you to define your elements as blocks, but still keep them in the text flow (kinda the way the <img> tag works by default). If you combine this with fixed element widths, and wapper divs around rows, you could acheive something similar to a table, although it may be hard to get it to expand dynamically with the page width.

这个一个大的gotcha错误是 inline-block 仅适用于IE6 / 7中的默认样式为<$ c $的元素c> display:inline 。换句话说,它适用于< span> ,但不适用于< div> 。不是灾难,而是一些要注意的事情,特别是因为你具体询问IE6支持。除此之外,好消息是,你应该能够使用 display:inline-block 避免任何其他黑客或解决方法。

The one big "gotcha" bug around this is that inline-block only works in IE6/7 for elements that have a default style of display:inline. In other words, it works for a <span> but not for a <div>. Not a disaster, but something to be aware of, especially since you're specifically asking about IE6 support. Other than that, the good news is that you should be able to get away with using display:inline-block without any other hacks or work-arounds.

这篇关于IE6 CSS显示:表修复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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