Min / Max width (IE included)


/ Published in: CSS
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.