---
title: "几种 css hack 方法"
author: "deng131"
date: "2012-10-31T22:38:09Z"
tags: []
categories: ["Web前端"]
slug: "css-hack"
draft: false
lastmod: "2012-10-31T22:37:51Z"
id: 1709852
url: "https://thinking80s.iteye.com/blog/1709852"
---

第一种：!important方式
.DIV{  
background:orange;/*ff*/  
*background:green!important;/*IE7*/  
*background:blue;/*IE6*/  
}  

第二种：样式属性前缀式
.DIV{  
margin:10px;/*ff*/  
*margin:15px;/*IE7*/  
_margin:15px;/*IE6*/  
}  

第三种：选择前缀式
#DIV{color:#333;}/*ff*/  
*html#DIV{color:#666;}/*IE6*/  
*+html#DIV{color:#999;}/*IE7*/

第四种：IE条件式
<!-->
<link type="text\css" href="IE.css" rel="stylesheet"/>
<!-->