views:

59

answers:

2
  1. Is it possible to implement this in IE6?
  2. If possible,how?
+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
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
I'm not trying to limit the viewport,but an img.img {max-width:640px;}
Newbie
? So what. Then just change the css selector
jitter
Before considering a CSS expression, have a look at http://developer.yahoo.com/performance/rules.html#css_expressions.
Marcus