为什么我不能在标准模式下更改光标? [英] Why can't I change a cursor in standards mode?

查看:106
本文介绍了为什么我不能在标准模式下更改光标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <!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.

这篇关于为什么我不能在标准模式下更改光标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆