史上最全的css hack(ie6-9,firefox,chrome,opera,safari)
在這個瀏覽器百花爭鳴的時代,作為前端開發的我們為了我們漂亮的設計能適應各個瀏覽器可為煞費苦心,主要體現在javascript和css上面。javascript我這次就不談了,先說說css。
<html>
<head>
<title>Css Hack</title>
<style>
#test
{
width:300px;
height:300px;
background-color:blue; /*firefox*/
background-color:red\9; /*all ie*/
background-color:yellow\0; /*ie8*/
+background-color:pink; /*ie7*/
_background-color:orange; /*ie6*/
}
:root #test { background-color:purple\9; } /*ie9*/
@media all and (min-width:0px){ #test {background-color:black\0;} } /*opera*/
@media screen and (-webkit-min-device-pixel-ratio:0){ #test {background-color:gray;} } /*chrome and safari*/
</style>
</head>
<body>
<div id="test">test</div>
</body>
</html>
原文地址:http://www.cnblogs.com/WuQiang/archive/2011/08/23/2150240.html推薦閱讀
史上最全的css hack(ie6-9,firefox,chrome,opera,safari)
最全的ASP.NET開源CMS匯總
開源史上最成功的八個開源軟件
利用 Css2Less 將 CSS 轉成 LESS