通过HTML注释实现方便的css hack

<!DOCTYPE html>
<!--[if IE]>
	<![if IE 5]>
		<html class="ie ie5">
	<![endif]>
	<![if IE 6]>
		<html class="ie ie6">
	<![endif]>
	<![if IE 7]>
		<html class="ie ie7">
	<![endif]>
	<![if IE 8]>
		<html class="ie ie8">
	<![endif]>
	<![if IE 9]>
		<html class="ie ie9">
	<![endif]>
	<![if !((IE 6)|(IE 7)|(IE 8)|(IE 9))]>
		<html class="ie">
	<![endif]>
<![endif]-->
<!--[if !IE]><!-->
	<html lang="zh-CN" class="notie">
<!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
<title>测试</title>
<meta name="keywords" content="">
<meta name="description" content="">
	<style>
		html{background:#fff;}
		html.ie{background:#000;}
		html.ie5{background:#f00;}
		html.ie6{background:#0f0;}
		html.ie7{background:#00f;}
		html.ie8{background:#ff0;}
		html.ie9{background:#f0f;}
		html.notie{background:#0ff;}
	</style>
</head>
<body>
	通过注释为不同的ie添加class
	<br/>
	方便针对ie浏览器进行兼容处理
	<br/>
	请使用不同IE打开将显示不同的背景色
	<br/>
	>=IE10 将被判断为不是ie
</body>
</html>

编程技巧