Previous Message
Next Message

Max-Width in IE ala Svend Ofte - Make it validate?

Sent by Al Sparber on 15 January 2004 16:04


Ian P wrote:
> Is there any way to make Svend Ofte's excellent CSS
> scripting that simulates 'max-width' in IE [1]
> actually validate?
>
> I would love to be able to use max-width on my site,
> but the overwhelming majority of visitors use IE. Is
> there any way to let these pages validate while still
> using the script?

Sure. place it a conditional comment:

<!--[if gte IE 5]>
<style>
p {
border:1px solid red;
max-width:30em;
width:expression(
    document.body.clientWidth > (500/12) *
    parseInt(document.body.currentStyle.fontSize)?
        "30em":
        "auto" );
}
</style>
<![endif]-->

Just check which versions of IE support css expressions and note that
in this particular comment "if gte IE5" means "greater than or equal
to" so it will be read by IE5.0, 5.5, and 6. Adjust as necessary. Also
not this comment needs to be embedded in your page and cannot reside
in an external css file.

Al Sparber
PVII
http://www.projectseven.com

"Designing with CSS is sometimes like barreling down a crumbling
mountain road at 90 miles per hour secure in the knowledge that
repairs are scheduled for next Tuesday".



______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: