Tuesday, September 16th 2008

IE8 and max-width

Internet Explorer 8 beta 2 is behaving pretty strange when it comes to max-width. (And min-width?) It seems to cope with it sometimes, and sometimes not.

It passes the Acid2 test (which tests both min/max width/height). It also seems to cope perfectly well with this test page.

So why doesn’t it cope with the max-width rule I have in the CSS of this blog? I haven’t managed to work it out anyway. IE8 b2 doesn’t obey my rule that says paragraphs should be a maximum of 30 em units wide.

I have tried debugging the behaviour by changing various factors in the stylesheets but nothing seems to help. If anyone happens to know about this bug, please leave a comment.

Edit: I finally found the reason for max-width not working. This blog used the XHTML strict doctype which IE8 doesn’t understand. Now I have changed it for the HTML 5 doctype and it works beautifully.

5 Responses to this post:

  1. Cees T. says:

    I use img onload and set the width if the offsetWidth is too large.

  2. David Naylor says:

    Not sure I understand what you’re saying. It sounds complicated though …

  3. Anonymous says:

    I hear ya – I got the same problem. My sites made with (CMSMS) and set with a min/max width look like junk because IE8 Beta ignores the max width.

  4. dinu says:

    I did expriced the same problem try this it fixed my problem http://msdn.microsoft.com/en-us/library/cc351024(VS.85).aspx

  5. David Naylor says:

    Thx, but I've already found a solution. See the end of my post.