HTMLコメントで便利なcss hackを実現

1405 ワード

<!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>