- Is it possible to implement this in IE6?
- If possible,how?
views:
59answers:
2
+2
A:
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>
richard
2009-11-14 10:37:32
A:
- 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]-->
jitter
2009-11-14 10:40:16
I'm not trying to limit the viewport,but an img.img {max-width:640px;}
Newbie
2009-11-14 10:45:18
? So what. Then just change the css selector
jitter
2009-11-14 10:56:36
Before considering a CSS expression, have a look at http://developer.yahoo.com/performance/rules.html#css_expressions.
Marcus
2010-06-03 20:35:19