這年頭為什麼越出越多的瀏覽器-_-|||

拜託大家行行好 請愛用firefox好不好!!!!!

 

以下是修改CSS時

我們先以FF還有IE來做的不同的設定:

div#test {

background:pink; /*Firefox 背景變粉紅*/

background:red \9; /*IE6、IE7、IE8背景皆變紅色*/

}

 

 

但如果現在多出個chrome來搗蛋

可以用下面的方法設定:

 [方法一] Chrome & Safari 

/* will be red only in google chrome */
body:nth-of-type(1) #test{
    color:pink;
}

注意一下,(1)後面有一個空白鍵。

 [方法二] Chrome Only 

/* will be red only in google chrome */
#test1{color:green;}
@media screen and (-webkit-min-device-pixel-ratio:0) {
    #test1{color:red;}
}

 

下方為CSS hack的相容表:

  IE6 IE7 IE8 Firefox Chrome Safari
!important   Y   Y    
_ Y          
* Y Y        
*+   Y        
\9 Y Y Y      
\0     Y      
nth-of-type(1)         Y Y
arrow
arrow
    文章標籤
    css ie chrome hack
    全站熱搜

    cabuchi 發表在 痞客邦 留言(1) 人氣()