css在不同浏览器显示效果不同的问题

rczpf 2011-03-18 11:19:48
各位大侠:

写了一个测试页面,代码如下
<html>
<head>

<style type="text/css">

BODY[orient='landscape']{}BODY[orient='landscape'] > .hide-sub-nav {
width:300px;
}

</style>

<script>
function switchcss()
{
alert(document.body.getAttribute("orient"));
document.body.setAttribute("orient","landscape");
}
</script>
</head>

<body>

<button onclick="switchcss()" title="switch" type="button">cccc</button>
<button class=hide-sub-nav id="eeee" name="dddd" value="test" type="button">dddd</button>

</body>
</html>

现在的问题是,如果把BODY[orient='landscape']{}去掉,则在chrome不能正常改变按钮长度。而在ff可以

请问是什么原因?
多谢
...全文
512 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hch126163 2011-03-22
  • 打赏
  • 举报
回复
导入 w3c dtd 没有?

加个逗号试试
BODY[orient='landscape']{},BODY[orient='landscape']

很少使用 属性选择 !

修改body 的属性来改变样式,还不如,直接js 修改class 或者style
  • 打赏
  • 举报
回复
发错区了,而且发重了,请分别转到HTML/CSS区和跨浏览器兼容区各一个。
否则别人回答也容易被删除。
lijian8552 2011-03-18
  • 打赏
  • 举报
回复
做美工的就怕兼容性问题,你换个实现方式试试吧!
ycproc 2011-03-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 theforever 的回复:]
发错区了,而且发重了,请分别转到HTML/CSS区和跨浏览器兼容区各一个。
否则别人回答也容易被删除。
[/Quote]

5,006

社区成员

发帖
与我相关
我的任务
社区描述
解读Web 标准、分析和讨论实际问题、推动网络标准化发展和跨浏览器开发进程,解决各种兼容性问题。
社区管理员
  • 跨浏览器开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧