本文介绍了为什么我不能在标准模式下更改光标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<!DOCTYPE HTML PUBLIC - // W3C // DTD HTML 4.0过渡// EN> < HTML>< HEAD> < TITLE>测试光标变更< / TITLE> < / HEAD> < BODY> < p style =cursor:url('a / web / images / catcursor.cur')>只适用于怪癖模式< / p> < / BODY>< / HTML>
如果我将Doctype更改为1.0,它会报告处于标准模式,并且光标不再更改。我该如何解决这个问题?
为什么我想要:我正在制作一个基于网络的游戏,并且有一次猫会攻击游标,所以我希望指针看起来很痛苦。 >
解决方案您需要指定一个预设的游标:
< p style =cursor:url('a / web / images / catcursor.cur'),default>预设值是游标属性有效。没有它,它是无效的,所以标准模式下的浏览器需要完全忽略它。
Example (tested in Chrome):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <TITLE>testing cursor change</TITLE> </HEAD> <BODY> <p style="cursor: url('a/web/images/catcursor.cur')" >only works in quirks mode</p> </BODY></HTML>If I change the Doctype to 1.0 it reports being in standards mode and the cursor no longer changes. How do I get round this?
Why I want to: I am making a web based game, and at one point a cat attacks the cursor, so I want the pointer to look distressed.
解决方案You'll need to specify a preset cursor:
<p style="cursor: url('a/web/images/catcursor.cur'), default">The preset value is required in order for the cursor property to be valid. Without it, it's invalid, so browsers in standards mode need to ignore it entirely.
更多推荐
为什么我不能在标准模式下更改光标?
发布评论