CSS .cur光标格式 [英] CSS .cur cursor format
问题描述
我设置了自定义光标 url(mouse2.cur)
,它没有变化。
I set custom cursor url(mouse2.cur)
and it doesnt change.
(mouse2.png)
效果很好!有什么问题?
(mouse2.png)
works perfectly! Whats the problem ?
body{
cursor: url(mouse2.cur),pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
推荐答案
不同的浏览器在光标的URL。
Different browsers have different support in url of the cursors.
Firefox / Mac,Safari / Mac,Chrome / Mac不支持PNG和JPG光标(已测试48px游标)。
IE仅支持CUR格式的光标。
Firefox/Mac, Safari/Mac, Chrome/Mac don't support PNG and JPG cursors (tested with 48px cursors). IE only supports cursors in the CUR format.
根据CanIUse: http://caniuse.com/#search=cursor
According to CanIUse: http://caniuse.com/#search=cursor
W3C CSS3规范指出:
W3C CSS3 Specification states:
UA必须支持以下图像文件格式:
The UA must support the following image file formats:
- 在[SVG]中定义的SVG,处于安全静态模式[SVG-INTEGRATION]
- 它们在其他属性中支持的任何其他非动画图像文件格式,例如background-image
属性
在[PNG]中定义的PNG
顺便说一句,W3C CSS3规范指出 .cur
游标应受大多数浏览器的支持。
By the way, W3C CSS3 Specification says that .cur
cursors should be supported by most browsers.
注意:在编写此规范时(2015年春季),普通桌面浏览器中仅
的光标支持的文件格式是
Microsoft设计的.ico和.cur文件格式。为了使
与旧内容兼容,鼓励UA支持
这些内容,即使缺乏开放规范也使得
无法对这些格式有规范要求。可以在Wikipedia上找到有关这些格式的一些
信息。
Note: At the time of writing this specification (spring 2015), the only file formats supported for cursors in common desktop browsers are the .ico and .cur file formats, as designed by Microsoft. For compatibility with legacy content, UAs are encouraged to support these, even though the lack of an open specification makes it impossible to have a normative requirement about these formats. Some information on these formats can be found on Wikipedia.
http://www.w3.org/TR/css3-ui/#cursor
最后,您的 .cur
文件可能已损坏,甚至链接到它都返回404错误。请检查指向您的 .cur
文件的链接。
Finally, your .cur
file may be broken or even link to it returns 404 error. Please check the link to your .cur
file.
这篇关于CSS .cur光标格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!