IE6下css样式表ID选择器不能以下划线开头
今天在写一个JavaScript效果时,使用了ID选择器,在IE7+浏览器,firefox,chrome测试后都没问题,结果在IE6中发现样式没起作用。刚开始还以为其他样式干扰了。后面查看ID,是以下划线开头,就是这个原因导致样式不起作用。IE6下css样式表ID选择器不能以下划线开头,+_+。。
测试代码如下
原创文章,转载请注明出处:IE6下css样式表ID选择器不能以下划线开头
测试代码如下
+展开
-HTML
<!DOCTYPE html />
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>IE6下css样式表ID选择器不能以下划线开头</title>
<style type="text/css">
#_test{background:#eee;height:300px;}
#test_{background:#aaa;height:300px;margin-top:20px;}
</style>
</head>
<body>
<div id="_test">ID为_test,#-test的ID选择器在IE6下不起作用</div>
<div id="test_">ID为test_,可以</div>
</body>
</html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>IE6下css样式表ID选择器不能以下划线开头</title>
<style type="text/css">
#_test{background:#eee;height:300px;}
#test_{background:#aaa;height:300px;margin-top:20px;}
</style>
</head>
<body>
<div id="_test">ID为_test,#-test的ID选择器在IE6下不起作用</div>
<div id="test_">ID为test_,可以</div>
</body>
</html>
加支付宝好友偷能量挖...
原创文章,转载请注明出处:IE6下css样式表ID选择器不能以下划线开头