Posted By

JimSangwine on 05/05/11


Tagged


Versions (?)

Cross-Browser Min Height


 / Published in: CSS
 

  1. div {
  2. min-height: 500px;
  3. height:auto !important;
  4. height: 500px;
  5. }
  6.  
  7. /*
  8. This works because (thankfully?) IE treats "height" how "min-height" is supposed to be treated.
  9.  
  10. Source: Dustin Diaz
  11. Alternate Using Expressions (IE Only)
  12. */
  13.  
  14. div {
  15. height: expression( this.scrollHeight < 501 ? "500px" : "auto" );
  16. }
  17.  
  18. /*
  19. Sets the minimum height in IE to be 500px. Make sure that this.scrollHeight < 501 is 1 px greater than the minimum height that you want or you will get some strange results.
  20. */

Report this snippet  

You need to login to post a comment.