Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS cursor zoom-in/out

I have buttons to zoom-in or zoom-out content. In firefox cursor works well (its like magnifier with +). But in chrome I have default cursor. This is my code:

.button.zoom-in {
   ...
   cursor: zoom-in;
}

Can someone help me, why that works in forefox and in chrome not? Also, other cursors like help, move, pointer... works in chrome too.

like image 378
debute Avatar asked Jun 02 '14 12:06

debute


People also ask

How do I zoom out my cursor?

If your mouse does not have a wheel, hold the Windows key and + (plus) or - (minus) to increase or decrease magnification.

How do you zoom out in CSS?

The non-standard zoom CSS property can be used to control the magnification level of an element. transform: scale() should be used instead of this property, if possible. However, unlike CSS Transforms, zoom affects the layout size of the element.

How do I customize my cursor in CSS?

Answer: Use the CSS cursor property You can define a custom cursor using the CSS cursor property. The cursor property takes the comma-separated list of user-defined cursors value followed by the generic cursor. First of all create cursor image and save it with the extension .


2 Answers

For Chrome you have to use the prefixed-property-value:

.button.zoom-in {
   ...
   cursor: -webkit-zoom-in;
   cursor: zoom-in;
}

Here is a jsfiddle.

like image 72
Fabian Mebus Avatar answered Sep 18 '22 12:09

Fabian Mebus


This page from Mozilla is an excellent reference to different cursors as well as browser compatibility for each.

For the zoom-in and zoom-out cursors, the following should work for Chrome 1.0+, Firefox 1.0+, Opera 11.6+ and Safari 3.0+. Zoom-in/out is not supported by IE.

.button.zoom-in {
    cursor: -moz-zoom-in; 
    cursor: -webkit-zoom-in;
    cursor: zoom-in;
}
like image 40
tohster Avatar answered Sep 16 '22 12:09

tohster