使わない方がいいと思いつつも使ってしまうCSSハック毎回検索してIE8が載ってないとかIE8はあるのにSafariがないとか何度も検索するのも面倒なんで自分用にメモしておきます。間違ってたり他のを知ってたらコメント頂けると嬉しいです。
他のプロパティも指定したい場合は、9がないときと同じように行末に;をつけて、次のプロパティからは/***/なくても大丈夫。
html>/**/body #hackcss {
color /***/: red9;
font-size: 20px9;
}
*:first-child+html #hackcss { color: red; }
#hackcss { *color: red; }
#hackcss { _color: red; }
* html #hackcss { color: red; }
html*#hackcss { color: red; }
/* これ以降Mac IE5のみに適用される \*//*/
#hackcss { color: red; }
/* これ以降Mac IE5以外にも適用される */
/* これ以降Mac IE5には適用されない \*/
#hackcss { color: red; }
/* これ以降Mac IE5にも適用される */
/* これ以降Netscape 4には適用されない /*/
#hackcss { color: red; }
/* これ以降Netscape 4にも適用される */
#hackcss, x:-moz-any-link { color: red; }
#hackcss, x:-moz-read-only { color: red; }
#hackcss, x:-moz-broken { color: red; }
#hackcss, x:-moz-broken, x:last-of-type { color: red; }
body:first-of-type #hackcss { color: red; }
属性セレクタをサポートするFirefox、Mozilla、Safari、Operaにのみスタイルが適用される。
html[xmlns] #hackcss { color: red; }
html[xmlns*=""] body:last-child #hackcss { color: red; }
html[xmlns*=""]:root #hackcss { color: red; }
*|html[xmlns*=""] #hackcss { color: red; }
@media screen and (-webkit-min-device-pixel-ratio:0) {
#hackcss { color: red; }
}
body:nth-of-type(1) #hackcss { color: red; }
body:first-of-type #hackcss { color: red; }
;;body #hackcss { color: red; }
html:\66irst-child #hackcss { color: red; }
body[class|="hypen-ated"] #hackcss { color: red; }
/* iPhone / mobile webkit */
@media screen and (max-device-width: 480px) {
#hackcss { color: red; }
}
<link media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" rel="stylesheet" />
試していないものもいっぱいありますがとりあえずまとめてみました。
CSSの振り分け

