网页中最小高度问题

设计网站经常会遇到最小高度问题 内页内容中如果内容少footer随之会上去 整个页面很不协调
解决这个问题 可以利用min-height
min-height就是你的层的最小高度,如果该层中的元素内容高度小于这个高度,就将层显示为
min-height的值超过的话,就撑破层,使层的高度与元素内容高度一样。
这2个样式仅对IE 7.0和firefox2.0以上版本的浏览器有效!
ie6就使用这一句代码height:e­xpression(this.scrollHeight < 200 ? "200px" : "auto");


/* 最小寬度 */
.min_width{
  min-width:300px;
  /* sets max-width for IE */
  width:e­xpression(document.body.clientWidth < 300 ? "300px" : "auto");
}

/* 最大寬度 */
.max_width{
  max-width:600px;
  /* sets max-width for IE */
  width:e­xpression(document.body.clientWidth > 600 ? "600px" : "auto");
}

/* 最小高度 */
.min_height{
  min-height:200px;
  /* sets min-height for IE */
  height:e­xpression(this.scrollHeight < 200 ? "200px" : "auto");
}

/* 最大高度 */
.max_height{
  max-height:400px;
  /* sets max-height for IE */
height:e­xpression(this.scrollHeight > 400 ? "400px" : "auto");
}

/* 最大最小寬度 */
.min_and_max_width{
  min-width:300px;
  max-width:600px;
  /* sets min-width & max-width for IE */
  width: e­xpression(
    document.body.clientWidth < 300 ? "300px" :
       ( document.body.clientWidth > 600 ? "600px" : "auto")
  );
}

/* 最大最小高度 */
.min_and_max_height{
  min-height:200px;
  max-height:400px;
  /* sets min-height & max-height for IE */
height: e­xpression(
    this.scrollHeight < 200 ? "200px" :
      ( this.scrollHeight > 400 ? "400px" : "auto")
  );
}



文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
评论: 1 | 引用: 0 | 查看次数: 946
  • 1
129139 [2009-05-18 05:29 PM]

收了

支持原创
  • 1
发表评论
昵 称:
密 码: 游客发言不需要密码.
验证码: 验证码
内 容:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 关闭 | [img]标签 关闭