相容IE6,IE7和firefox可以使用的一些css hack:

來源:互聯網
上載者:User

標籤:

.一些問題是瀏覽器自身的問題,遇到問題發生無法避免的情況下,那就要考慮使用一些css hack了,以下是針對
IE6,IE7和firefox可以使用的一些css hack:
(1)




a: 針對區別IE6 和IE7/firefox, 可以在要區別的代碼後面跟上!important
注意:ie6也認識!important;只要ie7/ie8/ff優先執行!important的屬性。
例:#test{
    float:left;
    (1)
    (2)
}
最終顯示:ie6下test是紅色,而ie7/ie8/ff優先執行(1),所以test是藍色

b:針對IE7/firefox 在css的前面加 [xmlns], 如下面的left屬性,如果我想要只針對IE7/IE8/firefox起作用,寫法如
下:
[xmlns] #ltest {
  line-height: 28px; color: rgb(101, 95, 87); font-size: 16px; orphans: 2; widows: 2;"> border:4px solid #999;
 padding:5px;
 width:200px;
 height:200px;
}

c: 只針對IE6起作用
(1)可以在屬性前面加上底線:
*html #test {

 _ line-height: 28px; color: rgb(101, 95, 87); font-size: 16px; orphans: 2; widows: 2;">}
(2)可以在css前面加* html,如:
*html #test {
  line-height: 28px; color: rgb(101, 95, 87); font-size: 16px; orphans: 2; widows: 2;">}

d: 只針對IE7起作用,在css裡前面加*+html,如:
*+html #test {
 
}

e:針對ie6/ie7/ie8認識,ff不認識,在css屬性值後邊加\9,如:
#test {
 
 
}

(2)
//將所有ie7以上的瀏覽器降級到ie7,就不用調節ie8以及以上的相容了

 出處:http://xiaogai1010.blog.163.com/blog/static/137170308201224094398/

相容IE6,IE7和firefox可以使用的一些css hack:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.