在IE6下分别设置div高度为5、10、15、20px。
源码:<!DOCTYPE HTML>
<html> <head> <title>IE6_minHeight.html</title> <meta http-equiv="content-type" content="text/html; charset=GB18030"> <style type="text/css"> .div_5px {height:5px; width:5px; background-color:#000;margin-bottom:10px;} .div_10px{height:10px;width:10px;background-color:#000;margin-bottom:10px;} .div_15px{height:15px;width:15px;background-color:#000;margin-bottom:10px;} .div_20px{height:20px;width:20px;background-color:#000;margin-bottom:10px;} </style> </head> <body> <div class="div_5px"></div> <div class="div_10px"></div> <div class="div_15px"></div> <div class="div_20px"></div> </body> </html>
结果IE6显示如下
我们想要的效果
后来用line-height 来解决
<!DOCTYPE HTML> <html> <head> <title>IE6_minHeight.html</title> <meta http-equiv="content-type" content="text/html; charset=GB18030"> <style type="text/css"> .div_5px {height:5px; width:5px; background-color:#000;margin-bottom:10px;line-height:5px;} .div_10px{height:10px;width:10px;background-color:#000;margin-bottom:10px;line-height:10px;} .div_15px{height:15px;width:15px;background-color:#000;margin-bottom:10px;line-height:15px;} .div_20px{height:20px;width:20px;background-color:#000;margin-bottom:10px;} span{display:none;} </style> </head> <body> <div class="div_5px"><span>.</span></div> <div class="div_10px"><span>.</span></div> <div class="div_15px"><span>.</span></div> <div class="div_20px"><span>.</span></div> </body> </html>
IE6 显示正常