CSS Cursors – How To Use Them

One thing that CSS allows us to use for screen presentation are alternate cursors. This is not the idea of downloading or forcing a download of a cursor, as was done in the past (though that is possible as well), but instead, we use several built in concept cursors.

Each of these cursors you can use to enhance usability of your website. For instance, if you want to define that something has context help, you could use the help cursor.

The CSS2 standard gives us 17 options for cursors, plus the option to use an external cursor from a URI. For two of the cursor options, there could have been slightly better phrasing, because it is a touch confusing for some people to remember. Two of the options are auto and default . Now, auto is actually the default value if you don’t explicitly set a cursor to be applied. To the W3C, I imagine this wasn’t a concern because they use the wording ‘initial’ value, instead of ‘default’ value. Unfortunately, in practice, most people tend to say ‘default’ value, instead of ‘initial.’ So, just keep in mind that the ‘default’ value for a cursor is actually ‘auto’ and not ‘default’ .

I mentioned that there is also the option to use the cursor for an call to a remote cursor. So, let’s say that you have a cursor you would like the browser to use, and you have it stored at a specific location. You could do the following:

<p style=”cursor: url(preferredcursor.cur)”>Text</p>

Now, the problem is that not all browsers may be able to load or use that cursor. Let me give an example of one that browsers might have a hard time viewing, and the way you can still set an alternative.

In CSS or Inline: acroynm { cursor: url(1.svg), url(2.cur), help }

The first one (1.svg) is the preferred cursor and if the browser can handle loading and displaying and SVG file, it will do that one. If not, it moves to the second, and tries to load the 2.cur file as the cursor. If it cannot, it will instead display the built-in help cursor.