XML technologies / CSS / CSS Cookbook / Links and navigation / Alternative cursor symbols

(Excerpt from “CSS Kochbuch” by Christopher Schmitt)

Problem

Show a clock instead of the usual cursor when the mouse hovers over a link, as in the following figure.

A clock appears as the cursor

Figure: A clock appears as the cursor.

Solution

Use the property cursor to customize the cursor:

a:link, a:visited {
 cursor: wait;
}

Discussion

The property cursor accepts several values, listed in the next table. Support depends heavily on the browser. Opera 7 and Internet Explorer 5.5+ for Windows support the property cursor, while Netscape Navigator 6+ understands most values except uri. In Netscape, values for cursor are not inherited by child elements.

Table: Values of the cursor property.

Value

Description

Example

auto

The browser determines the cursor’s appearance.

auto

crosshair

Two lines intersecting at their centers: a crosshair like a large plus sign.

crosshair

default

A platform-dependent cursor, usually an arrow in most browsers, which may vary with the user agent and operating system.

default

pointer

Indicates that the pointer is over a link. Sometimes a hand with an extended index finger, but it can differ with the operating system and user agent.

pointer

move

Indicates that an element can be moved. Sometimes a crosshair with arrowheads at its ends or an open hand.

move

e-resize, ne-resize, nw-resize, n-resize, se-resize, sw-resize, s-resize, w-resize

An arrow showing the direction in which a side can be moved. se-resize, for example, means southeast: down and to the right.

se-resize

text

Indicates that text can be selected. Similar to the cursor in word processors, resembling a capital I.

text

wait

Indicates that the computer is busy. Sometimes an hourglass.

wait

progress

Indicates that the computer is busy but the user can still interact with the browser.

progress

help

Indicates that information or help is available, often on the target page. Sometimes a question mark or an arrow with a question mark.

help

<uri>

The default cursor can be replaced by an externally defined cursor, such as an image, a Windows cursor file, a cursor in SVG, or something else.

N/A

Adding a custom cursor uses code similar to defining an element’s background image:

a.help:link, a.help:visited{
 cursor: url(bewildered.gif);
}

When changing default cursors, remember that most users find this somewhere between mildly distracting and extremely annoying, depending on the extent of the changes. Change the familiar cursor at your own risk.

See also

The CSS 2.1 specification for the property cursor.

  

 

 

 

back to top