css - Internet Explorer 版本 6 和 7 - 最小宽度问题

标签 css internet-explorer-7 internet-explorer-6

我正在尝试针对 ie 6 的最小宽度的解决方法。

看下面的代码

  <!--[if lte IE 6]>
  <style type="text/css">
 .left_2 {width:expression(document.body.clientWidth < 137? "135px": "21.5%" )  !important; padding-left:7.5px; padding-right:7.5px; height:auto; float:left;}
  </style>
  <![endif]-->
  <style type="text/css">
  .left_2 {  min-width:135px; width:21.5%; padding-left:7.5px; padding-right:7.5px; height:auto; float:left; }
  </style>

但是这似乎对 ie6 和 ie7 都没有任何影响。我什至将文档类型设置为严格以使它在 ie 7 上工作...有什么问题吗?

编辑:这是你的意思吗?

  <style type="text/css">
  .left_2 {  min-width:135px; width:21.5%; padding-left:7.5px; padding-right:7.5px; height:auto; float:left; }
  </style>


  <!--[if lte IE 6]>
  <style type="text/css">
 .left_2 {width:expression(document.body.clientWidth < 137? "135px": "21.5%" ) !important;}
  </style>
  <![endif]-->

最佳答案

IE6 看到的内容:

Set "width" to the result of an expression
Set "width" to 21.5%

将条件注释放在常规样式之后,而不是之前。

关于css - Internet Explorer 版本 6 和 7 - 最小宽度问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8906322/

相关文章:

css - Angular Material Icon 显然不会对齐,无论您对它做什么?尽管 Flex Layout 指令和 CSS 会影响它,但它永远不会对齐

javascript - html 和 javascript 中的依赖下拉列表

css - 只为 IE 加载较低的媒体查询

javascript - jquery IE6-7 错误

html - Bootstrap : centering content in Nav and changing default beavior on smaller screens

html - 如何在其父元素上方垂直对齐具有可变高度的绝对元素?

html - IE7 默认元素为 100% 宽度

javascript - 仅 IE7 中的 jQuery 问题

html - IE6 奇怪的边距问题

html - IE6子菜单列表不被删除