background

Allows you to set all values of the background in one declaration. We recommend that you instead use the specific background-attributes.

Value Description
color Hexadecimal - a pound sign (#) followed by at most 6 hex values(0-F).
RGB - individual values for Red, Green, and Blue.
color term - sets the color using names. i.e. red, orange, white, etc.
size px - size in terms of pixels
em - size in terms of the current font size
in - size in terms of inches
cm - size in terms of centimeters
percentage The width of this element will be a percentage of the element it is inside of.
pos-key-term Uses key terms to specify the location. Available terms: top, right, bottom, left, and center.
url relative - specifies the location with respect to the local directory
exact - specifies the location with the full url
repeat The image will repeat both vertically and horizontally.
repeat-x The image will repeat horizontally.
repeat-y The image will repeat vertically.
no-repeat The image will not repeat in either direction.
fixed The image will remain fixed and will not scroll when the page scrolls.
scroll The image will scroll when the page scrolls.

Code:

h2 { background: url(../../pics/cssT/smallPic.jpg) no-repeat center right; }
h3 { background: red url(http://example.com/noPic.jpg); }
p { background: #0aaaaa; }

Display:

This is a header 2 with a css background

This is a header 3 with a css background

This is a paragraph with a css background