display:table,max-width,text-overflow,overflow在IE8中不起作用

时间:2013-06-21 18:53:55

标签: html css internet-explorer-8 css-tables

对于各种与jQuery / Javascript相关的原因,我使用的是使用display:table和display:table-cell设置数据的div。标记看起来像这样:

<div style="display:table; width:100%">
  <div style="display:table-cell; width:20%;">Stuff</div>
  <div style="display:table-cell; width:60%; max-width:600px; overflow: hidden;">
    Longer Stuff
  </div>
  <div style="display:table-cell; width:20%;">Stuff</div>
</div>

样式实际上是css,而不是样式属性,但这是一般的想法。网站本身是固定宽度,因此像素为#。

这在我测试的所有浏览器中都非常有效,除了IE8(我还没有在IE9中测试过)。但是,在IE8中,中心列似乎忽略了overflow和max-width属性。这是IE8中的错误吗?如果是这样,是否有可能在没有找到一种新方法来制表我的数据的情况下解决这个问题?

2 个答案:

答案 0 :(得分:0)

您不应在样式属性中使用=符号。您应该使用:。这可能是你的问题。将max-width=60px更改为max-width: 60px

答案 1 :(得分:0)

GCyrillus建议在注释中解决问题的方法 - 设置表格布局:固定到外部div(一个样式为display:table)。

相关问题