自定义CSS光标点击点 [英] Custom CSS cursor click point
问题描述
如何为由 cursor:url(theCursorUrl);
创建的游标提供自定义点击点?
例如您正在使用光标的手(抓取)图像。
How can I give a custom click point to cursors created by cursor: url(theCursorUrl);
?
e.g. you're using a hand(grab) image for the cursor. But you want that the middle of the image to be the point where the actual cursor points.
推荐答案
CSS3支持设置光标图像的中点,其中指针的热点(即,点击注册)是:
CSS3 supports setting the midpoint of a cursor image, where the hotspot of the pointer (i.e. the point at which clicks are registered) is:
cursor: url(mycur.cur) 6 6, auto;
两个 6
和从顶部开始的6个像素。默认热点始终是图片的左上角,即 0 0
。
Where the two 6
values mean 6 pixels from the left and 6 pixels from the top respectively. The default hotspot is always the top left corner of your image, i.e. 0 0
.
此功能的浏览器支持可能相当穷,虽然它是一个CSS3功能,所以它不是你应该依赖的东西只是还没有。 (就是说,Firefox从1.5版本开始支持它!)如果浏览器无法解释坐标, cursor
属性将被忽略,因此请小心。
Browser support for this feature may be rather poor though as it's a CSS3 feature, so it's not something you should rely on just yet. (That said, Firefox has supported it from version 1.5!) If a browser can't interpret the coordinates, the cursor
property will be ignored, so be careful.
这篇关于自定义CSS光标点击点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!