how to set width for IE in css

It is for static page, dynamic page, website, SEO, performance and other web development discussion
Joshi jahanvi

how to set width for IE in css

Postby Joshi jahanvi » Wed Sep 17, 2014 4:45 pm

How can you set a minimum width for IE?


Guest

Re: how to set width for IE in css

Postby Guest » Tue Sep 23, 2014 5:28 pm

To set a minimum width, the CSS property is 'min-width'. This can be very useful and works well in good browsers. IE doesn't understand 'min-width'. However, it has a proprietary property called 'expression' which allows us to feed it javascript via a stylesheet. Below is how to set a (780px) minimum width for IE...


<!--[if gte IE 5]> <style type="text/css">
body {
width:expression(documentElement.clientWidth < 780 ? (documentElement.clientWidth == 0 ? (body.clientWidth < 780 ? "780px" : "auto") : "780px") : "auto" );
}
</style>
<![endif]-->

As the property is non-standard, it won't validate with the W3C validator, so if we put it in the head like this (above) - in an IE conditional comment - the validator will ignore it and the page will get a clean bill of health.


Return to “PHP, HTML, MYSQL and Web Hosting”

Who is online

Users browsing this forum: No registered users and 2 guests