| Hack 符號 | 識別瀏覽器 | 備註 |
|---|---|---|
\9(反斜線九) | IE6/7/8/9/10 | 屬性值結尾 |
*(星號) | IE6/7 | 屬性名前綴 |
_(底線) | IE6 | 屬性名前綴 |
!important | IE7+、現代瀏覽器 | IE6 忽略 |
#box {
background: blue; /* Firefox, Chrome, Safari, Edge, IE11+ */
background: red\9; /* IE6~IE10 */
*background: black; /* IE6, IE7 */
_background: orange; /* IE6 only */
}
讀取順序:由上而下,後蓋前。IE6 會依序讀到藍→紅→黑→橘,最終呈橘色。
#tip {
background: blue; /* FF */
*background: black; /* IE7 */
_background: orange; /* IE6 */
}
#tip {
background: blue; /* FF */
*background: green !important; /* IE7 */
*background: orange; /* IE6 */
}
IE7 讀得懂 * 也懂 !important → 綠色;IE6 只懂 * → 橘色;FF 忽略 * 但懂 !important → 藍色。
<!--[if lte IE 9]><link href="ie-fix.css"><![endif]-->