为什么我不能在标准模式下更改光标?

编程入门 行业动态 更新时间:2024-10-23 08:38:08
本文介绍了为什么我不能在标准模式下更改光标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

更多推荐

为什么我不能在标准模式下更改光标?

本文发布于:2023-11-15 04:19:06,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:我不   能在   光标   标准   模式下

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!