Background and Color Properties


HTML enables you to specify background and color properties for text, link, and backgrounds on a global basis in the document head; CSS provides similar properties that enable you to customize colors for individual elements (or for the entire page, if you prefer). The following properties affect foreground and background colors of elements.

background

Usage

Shorthand property for setting the individual background properties at the same place in the style sheet.

CSS1 Values

[<'background-color'> || <'background-image'> || <'background-repeat'> || <'background-attachment'> || <'background-position'>]

CSS2 Values

inherit

Initial

Not defined.

Applies to

All elements.

Inherited

No.


background-attachment

Usage

If a background image is specified, this property specifies whether it is fixed in the viewport or scrolls along with the document.

CSS1 Values

scroll | fixed

CSS2 Values

inherit

Initial

scroll

Applies to

All elements.

Inherited

No.


background-color

Usage

Sets the background color of an element.

CSS1 Values

<color> | transparent

CSS2 Values

inherit

Initial

transparent

Applies to

All elements.

Inherited

No.


background-image

Usage

Sets the background image of an element.

CSS1 Values

<uri> | none

CSS2 Values

inherit

Initial

none

Applies to

All elements.

Inherited

No.

Notes

Authors also should specify a background color that will be used when the image is unavailable.


background-position

Usage

Specifies the initial position of the background image, if one is specified.

CSS1 Values

[[<percentage> | <length>](1,2) | [top | center | _bottom] || [left | center | right]]

CSS2 Values

inherit

Initial

0% 0%.

Applies to

Block-level and replaced elements.

Inherited

No.


background-repeat

Usage

Specifies whether an image is repeated (tiled) and how, if a background image is specified.

CSS1 Values

repeat-x | repeat-y | repeat | no-repeat

CSS2 Values

inherit

Initial

repeat

Applies to

All elements.

Inherited

No.


color

Usage

Describes the foreground color of an element's text content.

CSS1 Values

<color>

CSS2 Values

inherit

Initial

Depends on browser.

Applies to

All elements.

Inherited

Yes.





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

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