【问题标题】:About max-width in IE6关于 IE6 中的 max-width
【发布时间】:2009-11-14 18:56:09
【问题描述】:
  1. 是否可以在 IE6 中实现?
  2. 如果可能,怎么做?

【问题讨论】:

    标签: internet-explorer-6 css


    【解决方案1】:

    您可以使用 Javascript 获取视口宽度并计算位置,如下所述:http://www.svendtofte.com/code/max_width_in_ie/

    <style>
    p {
    border:1px solid red;
    width:expression( 
        document.body.clientWidth > (500/12) * 
        parseInt(document.body.currentStyle.fontSize)?
            "30em":
            "auto" );
    }
    </style>
    

    【讨论】:

      【解决方案2】:
      • 使用条件 cmets 仅对 IE6 启用此功能
      • 将具有 id 容器的元素的最大宽度限制为 850 像素。

      CSS:

      <!--[if IE 6]>
      <style type="text/css">
      img.img {
          width:expression(document.body.clientWidth > 640 ? "640px": "auto")
      }
      </style>
      <![endif]-->
      

      【讨论】:

      猜你喜欢
      • 2021-08-02
      • 1970-01-01
      • 2022-01-23
      • 2016-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-18
      • 1970-01-01
      相关资源
      最近更新 更多