<html> 
<head> 
<title>This is a test </title> 
<style type="text/css"> 
div{ 
width:100px; 
height:50px; 
background-color:red;display:block; 

div:hover{ 
background-color:yellow; 

</style> 
</head> 
<body> 
<div> 
为什么 
<div> 
</body> 
</html>
我的IE是IE7版本的,但是对于上述代码,当鼠标经过时,为什么div的背景颜色没有变化?为什么大家都说IE7中,div可以用:hover属性,而我的机器上不能正常显示了?还有,如何使用条件注释了?
<!--[if lte IE6]>
dfdfd
<![endif]-->
为什么这样的注释在IE7中直接显示在界面上了?

解决方案 »

  1.   

    IE7也不支持么?
    为什么网上,书上都说IE7可以支持的,而我的是IE7不支持,到底IE7支持不?
      

  2.   

    你的浏览器不是IE7吧?
    我在我的IE7中就可以正确显示你的代码。
      

  3.   

    IE7 和IE 8 都是正常的,建议楼主还是看下自己的浏览器吧
    还有 条件注释<!--[if lte IE6]> 
    dfdfd 
    <!--[endif]--> 
      

  4.   

    你代码不规范看下面代码,已测试通过
    [code=INIFile]
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
      <meta name="author" content="http://blog.csdn.net/xxd851116" />
      <style type="text/css"> 
    div{ 
    width:100px; 
    height:50px; 
    background-color:red;display:block; 

    div:hover{ 
    background-color:yellow; 

      </style> 
     </head> <body>
      <div> 为什么 <div> 
     </body>
    </html>[/code]