Font Properties


Far more powerful than the font tags and attributes found in HTML 4.01, cascading style sheets enable you to affect many additional elements of a font. CSS1 font properties assume that the font is resident on the client's system and specify alternative fonts through other properties. The properties proposed in CSS2 go beyond that, actually enabling authors to describe the fonts they want to use, and increasing the capability for browsers to select fonts when the font the author specified is not available.

font

Usage

A shorthand property for setting font-style, font-variant, font-weight, font-size, line-height, and font-family at the same place in the style sheet.

CSS1 Values

[['font-style' || 'font-variant' || 'font-weight']? 'font-size' [/'line-height']? font-family

CSS2 Values

caption | icon | menu | message-box | small-caption | status-bar | inherit

Initial

See individual properties.

Applies to

All elements.

Inherited

Yes.

Notes

Percentages allowed on font-size and line-height. For backward compatibility, set font-stretch and font-size-adjust by using their respective individual properties.


font-family

Usage

Specifies a list of font family names and generic family names.

CSS1 Values

[[<family-name> | <generic-family> [,]* [<family-name> | <generic-family>]

CSS2 Values

inherit

Initial

Depends on browser.

Applies to

All elements.

Inherited

Yes.

Notes

<family-name> displays a font family of choice (Arial, Helvetica, or Bookman, for example). <generic-family> assigns one of five generic family names: serif, sans-serif, cursive, fantasy, or monospace.


font-size

Usage

Describes the size of the font when set solid.

CSS1 Values

<absolute-size> | <relative-size> | <length> | _<percentage>

CSS2 Values

inherit

Initial

medium

Applies to

All elements.

Inherited

The computed value is inherited.

Notes

Percentages can be used relative to the parent element's font size.


font-size-adjust

Usage

Enables authors to specify a z-value for an element that preserves the x-height of the first choice substitute font.

CSS2 Values

<number> | none | inherit

Initial

none

Applies to

All elements.

Inherited

Yes.

Notes

Percentages can be used relative to the parent element's font size.


font-stretch

Usage

Specifies between normal, condensed, and extended faces within a font family.

CSS2 Values

normal | wider | narrower | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | exTRa-expanded | ultra-expanded | inherit

Initial

normal

Applies to

All elements.

Inherited

Yes.


font-style

Usage

Requests normal (roman or upright), italic, and oblique faces within a font family.

CSS1 Values

normal | italic | oblique

CSS2 Values

inherit

Initial

normal

Applies to

All elements.

Inherited

Yes.


font-variant

Usage

Specifies a font that is not labeled as a small-caps font (normal) or one that is labeled as a small-caps font (small-caps).

CSS1 Values

normal | small-caps

CSS2 Values

inherit

Initial

normal

Applies to

All elements.

Inherited

Yes.


font-weight

Usage

Specifies the weight of the font.

CSS1 Values

normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900

CSS2 Values

inherit

Initial

normal

Applies to

All elements.

Inherited

Yes.

Notes

Values 100 tHRough 900 form an ordered sequence. Each number indicates a weight that is at least as dark as its predecessor. normal is equal to a weight of 400, and bold is equal to a weight of 700.





Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day
Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition)
ISBN: 0672328860
EAN: 2147483647
Year: 2007
Pages: 305

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net