【发布时间】:2009-11-14 18:56:09
【问题描述】:
- 是否可以在 IE6 中实现?
- 如果可能,怎么做?
【问题讨论】:
【问题讨论】:
您可以使用 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>
【讨论】:
CSS:
<!--[if IE 6]>
<style type="text/css">
img.img {
width:expression(document.body.clientWidth > 640 ? "640px": "auto")
}
</style>
<![endif]-->
【讨论】: