IE6 / IE7 / Firefox 的margin问题解决办法
from:http://www.cnblogs.com/zzh/archive/2008/09/03/1283310.html
這兩天在做一個(gè)網(wǎng)站的布局,因?yàn)榻?jīng)常用firefox,所有的內(nèi)容都是在firefox下面調(diào)試的,等快完工了切回IE7一看,樣式差別好多,主要是在margin,padding這幾個(gè)元素的理解上。
我知道ie6?ie7?firefox?對(duì)margin的解釋都不同,去網(wǎng)上查了一下,可以通過(guò)!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?*/
現(xiàn)在常用了第一種,很好用,寫出來(lái)與大家分享。
在給一個(gè)例子:
#pages{margin:auto; width:910px; text-align:left; }
#pages{*width:915px !important;}?? /* IE7 */
轉(zhuǎn)載于:https://www.cnblogs.com/Athrun/archive/2009/05/05/1450301.html
總結(jié)
以上是生活随笔為你收集整理的IE6 / IE7 / Firefox 的margin问题解决办法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Silverlight 置于悬浮层之下
- 下一篇: 读者看《赢道:成功创业者的28条戒律》