CSS Basics.com

Chapter 12: CSS Backgrounds

Inherited: No


You can style the background of an element in one declaration with the background property.

background: #ffffff url(path_to_image) top left no-repeat fixed;


Or you can set each property individually

Background Attachment

If you are using an image as a background. You can set whether the background scrolls with the page or is fixed when the user scrolls down the page with the background-attachment property

background-attachment: value;


Background Color

You can specifically declare a color for the background of an element using the background-color property.

background-color: value;


Background Image

You can set an image for the background of an element using the background-image property.

background-image: url(path_to_image);


Background Position

You can position an image used for the background of an element using the background-position property.

background-position: value;


Background Repeat

You can set if an image set as a background of an element is to repeat (across=x   and/or   down=y) the screen using the background-repeat property.

background-repeat: value;


Previous Chapter: Chapter 11 - Anchors, links and pseudo classes

Next Chapter: Chapter 13 - CSS Borders

Valid XHTML 1.1! Valid CSS!

CONTENT © 2004-2008 CSS BASICS, a site by Splashpress Media.
Content written by Ben Partch with contributions from Paul O'Brien & Vinnie Garcia.
Terms of Use  -   Accessibility  -   Feedback