开发者

About max-width in IE6

开发者 https://www.devze.com 2022-12-11 15:59 出处:网络
Is it possible to implement this in IE6? If pos开发者_开发百科sible,how? You can use Javascript to get the viewports width and calculate the position as described here: http://www.svendtofte.com/code
  1. Is it possible to implement this in IE6?
  2. If pos开发者_开发百科sible,how?


You can use Javascript to get the viewports width and calculate the position as described here: 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>


  • Uses conditional comments to enable this only for IE6
  • Restricts element with id container to a max width of 850px.

CSS:

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

精彩评论

暂无评论...
验证码 换一张
取 消