O'Reilly logo

HTML, XHTML, and CSS Bible, Fifth Edition by Steven M. Schafer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 39. User Interface Styles

IN THIS CHAPTER

  • Changing the Cursor

  • User Interface Colors

  • User Interface Fonts

In Part III of this book you learned how to use CSS to style and format almost every part of an HTML document. However, there are several additional, user agent-related elements you can affect with CSS. This chapter shows you how to use styles on user interface elements—the mouse pointer, system colors, and system fonts.

Changing the Cursor

The CSS cursor property enables you to specify what cursor type should be displayed when the cursor is over a specific element. This property is used like any other property, with a familiar format:

cursor: value;

The cursor property supports the values listed in Table 39.1.

The uri value takes the following familiar form:

url("uri_path_to_resource")

This value is unique in that it supports several values and can be followed by a default value if none of the uri resources can be found or used. For example, the following property definition defines two external pointer files that should be used, and a fallback default of crosshair if those two resources cannot be used for some reason:

cursor: url("angle.cur"), url("simple.cur"), crosshair;

Note

Many general graphic editing programs and several specific programs can be used to create custom cursors. Try searching Google for "create cursor file."

Table 39.1. Values for the Cursor Property

Value

Description

auto

The user agent displays an appropriate cursor for the current context.

crosshair

The cursor is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required