• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

解决IE6不支持min-height的两种办法

实用代码 开心洋葱 1142次浏览 0个评论

解决IE6不支持min-height的两种办法

最小高度min-height是很有用的,但IE6却不支持。真烦人。有没有办法呢?

第一种方法:我们可以利用IE6不识别!important来实现:
 

height:auto!important;  
height:500px;  
min-height:500px;

 

这3句代码就让IE6也有了高度min-height的效果,大家可以把下面的代码复制保存成网页文件看看效果。
 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>爱问知识人网|电脑故障解决网站|网站源码分享共享资料|黑客防范|程序漏洞|电脑技巧教程|计算机软件编程错误|爱问知识网与你共分享</title>
</head>
<style type="text/css">
* {
    margin:0;
    padding:0;
}
body {
    font-family:Arial, Helvetica, 宋体, sans-serif;
    font-size:12px;
    text-align:center;
    background-color:#D4D5CC;
}
#wrapper {
    height:auto!important;
    height:500px;
    min-height:500px;
    width:760px;
    background-color:#e5e5e5;
    border:1px solid #fff;
    text-align:left;
    line-height:150%;
    padding:20px;
    margin:10px auto;
}
</style>
<body>
<div id="wrapper">
  <p>知识是人类进步的阶梯,汇集网络众多知识,你的疑问,就是我们要解答的,包括电脑硬件、软件,计算机维修,电脑编程,各种程序的漏洞,网站挂木马等,业界新闻等学习娱乐的好去处 </p>
  <p>&lt;br/&gt;</p>
  <p>Knowledge is the ladder of the progress of mankind, pooling network many knowledge, your question, is that we want to answer, including computer hardware, software, computer maintenance, computer programming, all kinds of program errors, and website hang Trojan, and that the industry news study the good place of entertainment<br />
  </p>
</div>
</body>
</html>

还有第二种方法:在IE6IE5IE7FF测试竟然正常,而且能通过W3C检测的,方法如下:

#test {

min-height:100px; //这一句在ie7和FF已经可以正常显示了

background:#BBB; 

_height:100px;  //这一句在ie6,ie5测试显示正常。但不能过W3C验证

overflow: visible; //这一句为了注明#test当内容超过100px时就自动延长

}  


注意:你必须保证#test以外的都要是overflow:visible。否则还是不会显示超出。


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明解决IE6不支持min-height的两种办法
喜欢 (0)

您必须 登录 才能发表评论!

加载中……