国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

瀏覽器特定的CSS Hacks匯總

2024-07-11 08:33:41
字體:
來源:轉載
供稿:網友

我不再使用CSS Hacks了,相反的是,我將使用IE的條件判斷將類應用到body標簽。
 
但是,我想記錄我之前碰到過的每一個瀏覽器特定的CSS 選擇器和樣式屬性。我相信也沒有其他方式提供樣式表給獨特的Safari.
 
利用這些CSS Hacks,你能夠更好的針對IE、Chrome、Firefox、Opera和Safari,代碼如下:
 
瀏覽器特定的CSS Hacks綜合列表:

復制代碼代碼如下:
/***** Selector Hacks ******/
/* IE6 and below */
* html #uno { color: red }
/* IE7 */
*:first-child+html #dos { color: red }
/* IE7, FF, Saf, Opera */
html>body #tres { color: red }
/* IE8, FF, Saf, Opera (Everything but IE 6,7) */
html>/**/body #cuatro { color: red }
/* Opera 9.27 and below, safari 2 */
html:first-child #cinco { color: red }
/* Safari 2-3 */
html[xmlns*=””] body:last-child #seis { color: red }
/* safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:nth-of-type(1) #siete { color: red }
/* safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:first-of-type #ocho { color: red }
/* saf3+, chrome1+ */
@media screen and (-webkit-min-device-pixel-ratio:0) {
#diez { color: red }
}
/* iPhone / mobile webkit */
@media screen and (max-device-width: 480px) {
#veintiseis { color: red }
}
/* Safari 2 – 3.1 */
html[xmlns*=””]:root #trece { color: red }
/* Safari 2 – 3.1, Opera 9.25 */
*|html[xmlns*=””] #catorce { color: red }
/* Everything but IE6-8 */
root *> #quince { color: red }
/* IE7 */
*+html #dieciocho { color: red }
/* IE 10+ */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
#veintiun { color: red; }
}
/* Firefox only. 1+ */
#veinticuatro, x:-moz-any-link { color: red }
/* Firefox 3.0+ */
#veinticinco, x:-moz-any-link, x:default { color: red }
/* FF 3.5+ */
body:not(:-moz-handler-blocked) #cuarenta { color: red; }
/***** Attribute Hacks ******/
/* IE6 */
#once { _color: blue }
/* IE6, IE7 */
#doce { *color: blue; /* or #color: blue */ }
/* Everything but IE6 */
#diecisiete { color/**/: blue }
/* IE6, IE7, IE8, but also IE9 in some cases */
#diecinueve { color: blue/9; }
/* IE7, IE8 */
#veinte { color/*/**/: blue/9; }
/* IE6, IE7 — acts as an !important */
#veintesiete { color: blue !ie; } /* string after ! can be anything */
/* IE8, IE9 */
#anotherone {color: blue/0/;} /* must go at the END of all rules */
/* IE9, IE10 */
@media screen and (min-width:0/0) {
#veintidos { color: red}
}

1.條件樣式表

像這樣的代碼你應該見過:

復制代碼代碼如下:
<link rel=”stylesheet” type=”text/css” href=”css/style.css” />
<!–[if IE]>
<link rel=”stylesheet” type=”text/css”href=”css/ie.css” />

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 横山县| 崇左市| 乐都县| 安阳县| 明光市| 哈尔滨市| 克什克腾旗| 前郭尔| 泉州市| 陆丰市| 阳朔县| 高清| 肃南| 宜川县| 岳池县| 新乡县| 基隆市| 日喀则市| 商丘市| 三明市| 吉林市| 康定县| 锦州市| 江孜县| 博湖县| 安岳县| 双牌县| 庄浪县| 曲沃县| 温州市| 伊吾县| 泰州市| 本溪| 黔西| 高邑县| 东乡族自治县| 湟源县| 扬州市| 沙雅县| 翼城县| 沂水县|