Sams Teach Yourself JavaScript in 24 Hours

Sams Teach Yourself JavaScript in 24 Hours

By Michael Moncur

Using CSS Properties

CSS supports a wide variety of properties, such as color and text-align in the previous example. The following sections list some of the most useful CSS properties for aligning text, changing colors, working with fonts, and setting margins and borders.

Aligning Text

One of the most useful features of style sheets is the capability to change the spacing and alignment of text. Most of these features aren't available using standard HTML. You can use the following properties to change the alignment and spacing of text:

Changing Colors and Background Images

You can also use style sheets to gain more control over the colors and background images used on your Web page. CSS includes the following properties for this purpose:

Working with Fonts

Style sheets also allow you to control the fonts used on the Web document and how they are displayed. You can use the following properties to control fonts:

Margins and Borders

Last but not least, you can use style sheets to control the general layout of the page. The following properties affect margins, borders, and the width and height of elements on the Web page:

Units for Style Sheets

Style sheet properties support a wide variety of units, or types of values you can specify. Most properties that accept a numeric value support the following types of units:

Which unit you choose to use is generally a matter of convenience. Point sizes are commonly used for fonts, pixel units for the size and position of layers or other objects, and so on.

Share ThisShare This

Informit Network