網頁縮小放大後錯位的解決方法(IE6有待解決)

今天在網上看文章的時候忽然看到了這(http://www.itlead.com.cn/article/html/148/2011-08-03/content-1279.shtml),由於我本身作網頁的時候也存在這個問題 縮小的時候浮動的div會出現錯位。按照做者的方法試了下,確實是能解決錯位問題,惋惜在IE6下,這種方法是不可取的。IE6下2個div都要浮動纔會在一直線。 html

一、由於寬度緣由。 瀏覽器

二、浮動緣由(我就是這個問題) 佈局

我是一個大DIV(固定寬度的)裏面有兩個小DIV(也是固定寬度的)一個左邊一個右邊。我也不知道爲何會錯位,我就試着改樣式。 字體

左邊寬度不變,右邊我把寬度去掉了,而且去掉了浮動。加個margin-left:左邊的寬度。而後就正常了。 ui

<!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=gb2312" />
<title>無標題文檔</title>
<style>
.clearfix:after{ content:"."; display:block;height:0;clear:both; visibility:hidden;} 
*html .clearfix{height:1%;}
*+html .clearfix{height:1%;}
.clearfix{display:inline-block;}
.clearfix {display:block;} 

.com{width:800px;padding:10px;border:1px solid #333;background:#eee;}
.left,.right{height:100px;}
.left{width:200px;background:#f60;float:left;display:inline;}
.right{margin-left:200px;background:#000;}
.r_c{width:100%;margin-right:10px;}
</style>
</head>
<body>
<div class="com clearfix">
    <div class="left">adfaaaaaaaaaaaaaaa</div>
    <div class="right"><div class="r_c">adfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div></div>
</div>
</body>
</html>


用戶經過鼠標滾輪放大或者縮小頁面的時候頁面的佈局不亂或者不發生floatdrop呢

產生緣由:

  1. 當心使用邊框,邊框在一些瀏覽器裏縮小時的最小寬度是 1px,不會隨着縮放比例變化,會致使 floatdrop。
  2. 覆蓋掉 Chrome 的字體最小尺寸,Chrome 下字體大小到最小尺寸後再也不縮小,會形成佈局變亂。
相關文章
相關標籤/搜索