目前主流浏览器的兼容性做的都比较好了,本文主要针对IE6,7的不兼容问题进行解决。

1.有浮动存在时,计算一定要精确,不要让内容的宽高超出我们所设置的宽高,IE6下,内容会撑开设置好的高度。

  解决方法:给对应的父级加overflow:hidden;但是会有部分被隐藏掉,最好是精确计算宽高再设定

eg:(ie会撑开)

 1 <style>
 2 .box{ width:400px;}
 3 .left{ width:200px;height:300px;background:red;float:left;}
 4 .right{ width:200px;float:right;}
 5 .div{width:180px;height:180px;background:blue;padding:15px;}
 6 /*
 7     计算一定要精确 不要让内容的宽高超出我们设置的宽高
 8     在IE6下,内容会撑开设置好的宽高
 9 */
10 </style>
11 </head>
12 <body>
13 <div class="box">
14     <div class="left"></div>
15     <div class="right">
16         <div class="div"></div>
17     </div>
18 </div>
19 </body>
View Code

相关文章:

  • 2021-12-23
  • 2021-07-31
  • 2022-12-23
  • 2022-02-03
  • 2022-01-20
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-04
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
相关资源
相似解决方案