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

2019-08-15 03:50发布

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.

标签: html css cursor
1条回答
可以哭但决不认输i
2楼-- · 2019-08-15 04:45

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.

查看更多
登录 后发表回答