IE6 / IE7 / Firefox 的margin问题解决办法
from:http://www.cnblogs.com/zzh/archive/2008/09/03/1283310.html
這兩天在做一個網站的布局,因為經常用firefox,所有的內容都是在firefox下面調試的,等快完工了切回IE7一看,樣式差別好多,主要是在margin,padding這幾個元素的理解上。
我知道ie6?ie7?firefox?對margin的解釋都不同,去網上查了一下,可以通過!important這樣的手段hack。
具體的做法有以下幾種:
第一種:
.div?{
??background:orange;/*ff*/
??*background:green?!important;/*ie7*/
??*background:blue;?/*ie6*/
}
第二種:
.div?{
??margin:10px;/*ff*/
??*margin:15px;/*ie7*/
??_margin:15px;/*ie6*/
}
第三種:
#div?{?color:?#333;?}?/*?ff?*/
*?html?#div?{?color:?#666;?}?/*?IE6?*/
*+html?#div?{?color:?#999;?}?/*?IE7?*/
現在常用了第一種,很好用,寫出來與大家分享。
在給一個例子:
#pages{margin:auto; width:910px; text-align:left; }
#pages{*width:915px !important;}?? /* IE7 */
轉載于:https://www.cnblogs.com/Athrun/archive/2009/05/05/1450301.html
總結
以上是生活随笔為你收集整理的IE6 / IE7 / Firefox 的margin问题解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Silverlight 置于悬浮层之下
- 下一篇: C#连接各类数据库 [转]