Custom Cursor Image CSS

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 16:11:08

Your problem may be that cursor URLs don't work in Firefox for the Mac.

You can get the same effect on Firefox by using the -moz-zoom-in keyword.

cursor:url(/img/magnify.cur), -moz-zoom-in, auto;

This will show magnify.cur, the Mozilla-specific zoom cursor or a system default cursor. The first cursor on the list that the browser supports is used.

You can also see a list of cursor keywords supported by different browsers.

This did the trick :)

a.heroshot img {
cursor:url(/img/layout/backgrounds/moz-zoom.gif), -moz-zoom-in;
}

UPDATE: The magnify icon is now supported natively in most browsers, so you can just use this CSS:

cursor: -webkit-zoom-in;
cursor: -moz-zoom-in;
cursor: zoom-in;

What if you enclose the url string with apostrohes?

a.heroshot img {
cursor:url('/img/magnify.cur'), pointer;
}

See also http://www.w3schools.com/CSS/pr_class_cursor.asp

(Based on Kevin Borders response)

The right fallback order is the following

a.heroshot img {
    cursor: url(/img/zoom_in.png), url(/img/zoom_in.cur), pointer;  
    cursor: url(/img/zoom_in.png), -moz-zoom-in;  
    cursor: url(/img/zoom_in.png), -webkit-zoom-in;
}

Tested with: Firefox 47, Chrome 51, Opera 36, Edge 13 and IE11.

user3335780

My side url property is working for cursor in following way

 #myid{cursor:url('myimage.png') , auto}

But here I think image size issue. Because If I use 32*32 size or below this then this work perfectly.

A comma separated list of URLs to custom cursors. Note: Always specify a generic cursor at the end of the list, in case none of the URL-defined cursors can be used

 #myid{cursor:url('myimage.png') , auto}
 #myid{cursor:url('myimage.png') ,url('myimage2.gif') , auto} etc

If you put only this then it will not work

 #myid{cursor:url('myimage.png')}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!