简体   繁体   English

IE5最大宽度支持和可能的解决方案

[英]IE5 max-width support & posible solution

I simply wanna set a max and a min width to my content in my IE5 compatible site i read out of this site that the solution below could solve it, in this following example i only show max width. 我只是想在我的IE5兼容站点中为我的内容设置最大和最小宽度,我从站点读出以下解决方案可以解决该问题,在下面的示例中,我仅显示最大宽度。

But there must be some issue cause it don't work can somebody tell me what is wrong? 但是必须存在一些问题,因为它不起作用,有人可以告诉我这是什么问题吗? or another solution - it can have a javascript solution - but i need to be IE5 supported? 或其他解决方案-它可以有一个javascript解决方案-但我需要受IE5支持吗?

* html .wrapper { 
   width: expression( document.body.clientWidth > 960 ? "961px" : "auto" ); /* sets max-width for IE */
}
html .wrapper{
  max-width: 960px;
}
  • A footnote i compile it with compass cause its as Sass project (it dosn't fail in the build step) 我用罗盘编译的脚注将其作为Sass项目(在构建步骤中不会失败)

If found out what made it bug 如果发现导致错误的原因

it seems that IE5 for some odd reason ignore the expression if your normal statement isn't width and not max-width see solution below 如果您的普通语句不是width而不是max-width,则出于某种奇怪的原因,IE5似乎会忽略该表达式,请参见下面的解决方案

* html .wrapper { 
   width: expression( document.body.clientWidth > 960 ? "961px" : "auto" ); /* sets max-width for IE */
}
html .wrapper{
  width: 960px;
}
html.gtie7 .wrapper{
  max-width: 960px;
  width: auto;
}

hope it was useful if anybody some day should run into the same problem 希望有一天有人遇到同样的问题很有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM