html - css 自定义光标不工作

标签 html css

我正在使用 css 自定义光标为光标使用图像。图像不起作用。这段代码有什么问题?
Here是使用的图像。 Fiddle

 cursor: url('http://www.sarkelliancreed.comule.com/pics/TREES.jpg'), auto;

最佳答案

昨晚我正在处理这个问题。问题是可以用作光标的图像大小有限制。如果你真的需要一个大的图像来跟随光标,让一个带有该图像的 div 捕捉到 mousemove 事件中的光标位置。

MDN 至少描述了 Firefox 的大小限制:

In Gecko (Firefox) the limit of the cursor size is 128×128px. Larger cursor images are ignored. However, you should limit yourself to the size 32×32 for maximum compatibility with operating systems and platforms.

MDN documentation for cursor property in CSS

输入这个笑脸而不是你正在使用的图像作为 URL 并再次运行 Fiddle,它工作了:http://icons-search.com/img/icons-land/IconsLandVistaStyleEmoticonsDemo.zip/IconsLandVistaStyleEmoticonsDemo-ICO-Cool.ico-32x32.png

关于html - css 自定义光标不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30309156/

相关文章:

html - Fitgrid - 在列的边缘添加边框

css - 使 flexbox 优先显示更多元素而不是元素的最大宽度

javascript - Jquery addclass 无法将 "fadeoutdown"效果应用于 DIV

javascript - 两个div并联在一起

html - 框阴影不超过包含元素的背景颜色

javascript - 如何仅向文本添加背景?

javascript - 占位符中的两种不同文本样式

html - 输入类型复选框无法正确微笑

javascript - jQuery 树问题

javascript - 单击任何内容元素时将焦点设置到 div