=波波日志 > HTML/WML/CSS兼容/XML > IE6下css样式表ID选择器不能以下划线开头=
IE6下css样式表ID选择器不能以下划线开头
今天在写一个JavaScript效果时,使用了ID选择器,在IE7+浏览器,firefox,chrome测试后都没问题,结果在IE6中发现样式没起作用。刚开始还以为其他样式干扰了。后面查看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>
类别:HTML/WML/CSS兼容/XML 作者:波波 日期:2011-03-25 【评论:0】
相关文章
暂时没有评论!
发表留言

