我想要的是指定游标:整个身体标签的指针,所以页面的背景是可点击的,但我也希望页面的其余部分像它一样工作,所以我尝试设置cursor:auto for div,其中包含这页纸.
在FF,Chrome和Safari中它工作正常,也在IE 6和7中.但似乎IE 8和9以及(拧它)OPERA对于什么光标有自己的看法:自动意味着.
这是一个片段,看看会发生什么:
<!DOCTYPE html>
<html>
<head>
<title>Cursor test</title>
</head>
<body>
<div id="newBody" style="width:400px; height:300px; cursor:pointer; background:#ffddee; border:2px solid #ddaa66;">
<div id="pageContent" style="width:200px; cursor:auto; background:#fff;">
<p>This is a paragraph <a href="">click here</a>.</p>
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
虽然这是一个HTML片段,但一切都是用javascript完成的,结果相同.
标准说的东西真的很模糊:UA根据当前上下文确定要显示的光标.,这些页面也没有帮助解决这个问题
http://www.w3.org/TR/CSS2/ui.html
http://msdn.microsoft.com/en-us/library/aa358795%28v=vs.85%29.aspx
http://www.w3schools.com/cssref/pr_class_cursor.asp
https://developer.mozilla.org/en/CSS/cursor
任何人都可以解释这种行为或知道可能的方法吗?
小智 6
使用CSS:
#pageContent {cursor:default}
#pageContent * {cursor:auto}?
Run Code Online (Sandbox Code Playgroud)
光标仍然在IE中始终是"默认",但至少其他浏览器显示预期的行为.
我认为 auto 继承了父样式(不确定),我尝试过cursor:default;,它在 IE 8 和 FF 3.6 中运行良好。
<div id="newBody" style="width:400px; height:300px; cursor:pointer; background:#ffddee; border:2px solid #ddaa66;">
<div id="pageContent" style="width:200px; cursor:default; background:#fff;">
<p>This is a paragraph <a href="">click here</a>.</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1557 次 |
| 最近记录: |