Color and Background Properties in DHTML


Setting Colors

The example below changes the color of the H1 tag.

H1 {color: "#FFCC99"}

Setting Background Colors

The example below changes the background colors of various tags.

BODY { background-color: #FF7777; }
H4 { background-color: #FF9999; }
P { background-color: #FFBBBB; }
B { background-color: #FFDDDD; }

Setting Background Images

Define a background image for a specific tag as shown below.

BODY { background-image: url(../images/stars.jpg)

Setting a Background Image's Repetition

A background image can be forced to not repeat and appear in a specific position in a window.

BODY { background-repeat: no-repeat; }

Positioning a Background

BODY { background-position: 75px 75px; }

Repeating Backgrounds Vertically and Horizontally

BODY { background-repeat: repeat-x; } ... repeats horizontally
BODY { background-repeat: repeat-y; } ... repeats vertically