針對各種瀏覽器css不相容的寫法

2022-04-23 14:15:21 字數 1595 閱讀 7740

/*針對谷歌瀏覽器核心支援的css樣式*/

@media screen and (-webkit-min-device-pixel-ratio:0)

/*針對ie6特製識別的css樣式*/

*html .searchbox

針對firefox瀏覽器的核心css寫法:

@-moz-document url-prefix()

}ie8就是自己來除錯了。除錯乙個瀏覽器,有不合適的地方可以在該核心css中重寫對應的方法,只需把不合適的樣式重寫即可實現。*html中則例外,需要每重寫乙個都要加*html單獨處理。

針對樣式名

如果只讓ie6看見用*html .head

如果只讓ie7看見用*+html .head

如果只讓ff看見用:root body .head

如果只讓ff、ie8看見用html>/**/body .head

如果只是不讓ie6看見用html>body .head 即對ie 6無效

如果只是不讓ff、ie8看見用*body .head    即對ff、ie8無效

針對具體屬性

如果只讓ie6看見用_     .head

如果只讓ie7看見用+與_結合的方法:     .head

ie8正式版hack

\9″ 例:」margin:0px auto\9;」.這裡的」\9″可以區別所有ie8和firefox.

「*」 ie6、ie7可以識別.ie8、firefox不能.

「_」 ie6可以識別」_」,ie7、ie8、firefox不能.

如:.a

從左到右分別對應 ff,ie8 ie7 ie6

*************************====

p                支援 ie7 ie6        不支援 ff  ie8b

p                支援ie6            不支援 ff

p   

p                支援 ie6 ie7 ie8b ff

p     支援ie7 ie8b ff     不支援ie6

head:first-child+body p    支援ie7 ie8b ff       不支援ie6

/*\*//*/

/**/                    支援ie8b            不支援ie6 ie7 ff

html*            支援ie6 ie7          不支援 ie8b ff

body>p            支援ie7 ie8b ff        不支援 ie6

html[xmlns] p         支援 ie7 ie8b ff    不支援 ie6

@import "style.css"

@import "style.css"

@import url(style.css)

@import url('style.css')

@import url("style.css")        支援 ie6 ie7 ie8b ff

p            支援 ie6 ie7  ff     不支援 ie8b

出自:

瀏覽器CSS相容

一 important 在ie6及ff中的使用 box1 box1 important是說這個設定有優先順序,ie碰到 important不會出錯只是忽略他的功能,假如後面又設定了width,ie會以最後設定的 width為準,假如後面再沒有其它設定,則會用當前這個值,也就是前面的 importan...

css 相容性問題,針對單個瀏覽器

針對火狐瀏覽器的css hack moz document url prefix 2針對webkit核心及opera瀏覽器的css hack media all and min width 0 3從這個樣式我們只能把webkit核心的瀏覽器和opera瀏覽器從其它瀏覽器中區分出來,但並不能區分它們倆...

css 多瀏覽器不相容問題

1 解決ie6 ie7 firefox相容最簡單的css hack寫三句 來控制乙個屬性,區別firefox,ie7,ie6 background orange background green important background blue 這段 會使在firefox中,背景呈橙色 ie7中為...