About max-width in IE6
- 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/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]-->
精彩评论