用css怎么实现:让一个div的背景色在IE6中显示成红色,在IE7中显示成蓝色,IE8中显示成绿色
用css如何实现:让一个div的背景色在IE6中显示成红色,在IE7中显示成蓝色,IE8中显示成绿色?
在一个页面中编写css代码,实现下面的功能:
让一个div的背景色在IE6中显示成红色,在IE7中显示成蓝色,IE8中显示成绿色?
如何实现?请告知!分不够,可以加分!
------解决方案--------------------
demo.htm用来显示效果。
ie6.css:
ie7.css
ie8.css
在一个页面中编写css代码,实现下面的功能:
让一个div的背景色在IE6中显示成红色,在IE7中显示成蓝色,IE8中显示成绿色?
如何实现?请告知!分不够,可以加分!
------解决方案--------------------
demo.htm用来显示效果。
<!DOCTYPE html>
<html>
<head>
<title>demo</title>
<meta http-equiv="Content-sytle" content="text/html;charset=utf-8" />
<style type="text/css">
div {
color:white;
}
</style>
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie6.css" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="ie7.css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="ie8.css" />
<![endif]-->
</head>
<body>
<div>
<p>this is a box.It will be red in ie6,blue in ie7,green in ie8.</p>
</div>
</body>
</html>
ie6.css:
div {
background-color: red;
}
ie7.css
div {
background-color: blue;
}
ie8.css
div {
background-color: green;
}