Why can't I change a cursor in standards mode?

假装没事ソ 提交于 2020-01-15 09:53:30

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/9104472/why-cant-i-change-a-cursor-in-standards-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!