最新CSS相容方案

來源:互聯網
上載者:User
最新的CSS相容方案,讓你的樣式完美相容各大瀏覽器,這個方案主要是用來解決Safari的,Opear是在測試的時候順帶試了一下,結果發現竟然也行,所以

順便也解決了。:)

.e {/*FF OP*/
background-color: #FF0000

}

html* .e{/*Sa IE7 OP*/
background-color:#FF00FF

}

*+html .e{
background-color:#000000;/*OP*/
*background-color:#0000FF;/*IE7*/

}

* html .e{/*IE6*/
background-color:#00FFFF

}

經FF2、OP9.21、OP9.10、Sa3.0.3(pc)、IE7、IE6測試通過,如果你在其他的瀏覽器版本上測試過,歡迎給我留言,把結果告訴我。

*需要注意的是:IE7對樣式的解釋跟DTD是有關,在沒有DTD的時候,IE7是能讀取IE6的hack的。*
**
更新的CSS
hack在下面,包括FF、IE6、IE7、Opear、Safari,需要注意的是IE由於在不同的DTD上渲染的模式不同,這個hack的使用要注意頁面是否使用了DTD或XML申明(<?xml
version="1.0" encoding="utf-8"?>)。

.class{
background-color:# FFFF00;/*所有瀏覽器*/
* background-color:#00FF00;/*IE*/
_ background-color:# 00FFFF;/*IE6*/

}

@media all and(min-width:0){
.class{
background-color:#FF00FF; /*Opera */

} }/*只有Opera識別*/

@media all and (min-width:0){
.class{
background-color:#FF00FF; /*Opera和Sa */
html* .class{
background-color:# 808080; /*Sa*/

}
}}

已在實際工作中應用,歡迎大家提供更好的解決方案。

相關文章

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.