HTML Hacks

November 24th, 2008

1. The problem with Min-width in InternetExplorer

IE understands this property as width. But the following hack works:

#page { width: expression (((document.documentElement.clientWidth || document.body.clientWidth) < 780)? "780px": "100 %") }

Validator would charge this as not valid, therefore I advise to transfer it into HTML code:

<!--[if gte IE 5]> <style type="text/css"> #page {width: expression(((document.documentElement.clientWidth || document.body.clientWidth) < 780)? "780px" : "100%")} </style> < ![endif]--> </style>

From the first page loading IE5 does not know what clientWidth is, therefore it is necessary to address to this size in <head> with the help of JavaScript...