Monday 28 January 2008

Internet Explorer: max-width of page

One user requested that we should limit the width of the page to make it more readable on wide screen displays. The CSS attribute max-width looked like the prefered way to realize this limitation - it will behave nicely on small screens. But it turned out that this attribute is not supported by the Internet Explorer. After some fruitless approaches we found this solution for our css file:

#mainContent
{
max-width:62em;
width:expression(document.body.clientWidth > 1024?"62em":"auto");
}

The max-width will work on all conforming browsers. The expression for width will only work on the Internet Explorer. The other browsers will ignore this command.

Oh dear, why is it such a problem to adopt and respect newer CSS standards?

No comments: