5

CSS:

#cursor {
  cursor: url(cursor.gif);
}

HTML:

<div id="cursor">
  <p>Hello world!</p>
</div>
1
  • What browser have you been testing? Commented Dec 12, 2015 at 22:44

1 Answer 1

4

According to MDN:

zero or more URLs may be specified (comma-separated), which must be followed by one of the keywords defined in the CSS specification, such as auto or pointer.

Therefore you need to define a cursor value as fallback for the url().

For instance, using auto:

#cursor {
  width: 100px;
  height: 100px;
  border: 1px solid;
  cursor: url(//placehold.it/20), auto;
}
<div id="cursor"></div>

Sign up to request clarification or add additional context in comments.

3 Comments

It is working in latest version of Chrome on OS X :) (+1)
OP is trying to use .gif as cursor, isn't that the main point of this question?
@NenadVracar The main point was that it wasn't working at all. My answer showed that you need to add auto. Regardless of whether the image is a png/gif/jpg`, the issue is still the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.