Posted By

a1ias on 07/28/11


Tagged

ie max-width min-width


Versions (?)

Min / Max width (IE included)


 / Published in: CSS
 

URL: http://www.1stwebdesigner.com/css/17-css-html-effects/

Well, many of you are used to just replace the lack of min / max width / height for IE with fixed dimensions, right? But you don’t need to do it anymore. IE is not a strict standards browser and sometimes we can take advantage of this to code things that would be awful to see in standard CSS code.

You can, in this case, insert some IE expressions (basically, JavaScript code) to check current body width and adjust element’s width.

  1. #content {
  2. width: expression(document.body.clientWidth < 762? "760px" : document.body.clientWidth > 1242? "1240px" : "auto");
  3. min-width: 760px;
  4. max-width: 1240px;
  5. }

Report this snippet  

You need to login to post a comment.