Create a Website
HTML
Dreamweaver
CSS Tutorial
JavaScript
FREE Hosting!
With every domain name
you register at DotEasy
you get FREE (no-ad)
one year hosting.
PLUS you get:
  • FREE Website Builder
  • FREE Blog
  • FREE Forum
  • FREE Photo Album
  • FREE Email Accounts
Get your FREE hosting today!
Home > CSS Tutorial
$0 Web Hosting

You can style the background of an element in one declaration with the background property. Values include attachment, color, image, position and repeat.

Background Attachment

If you are using an image as a background, you can set it to scroll or fixed:

The Code

background-attachment: value;

Values:

Background Color

The background-color property describes the background color of elements.

The Code

background-color: value;

Values include:

The element <body> contains all the content of an HTML document. Thus, to change the background color of an entire page, the background-color property should be applied to the <body> element. You can also apply background colors to other elements including headlines and text. For example,

The Code

h1 {
color:#990000;
background-color:#FC9804;
}

Background Image

The background-image property is used to insert a background image.

The Code

background-image: url(path_to_image);

Values include:

To insert an image as a background image for a web page, simply apply the background-image property to and specify the location of the image. For example,

The Code

body {
background-color: #FFCC66;
background-image: url(“image.jpg”);
}

Background Position

You can position a background image using the background-position property.

The Code

background-position: value;

Values include:

Background Repeat

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

The Code

background-repeat: value;

Values include:

Enjoy this tutorial?

1. Link to this page(copy/paste into your own website or blog):
2. Add this page to your favorite social bookmarks sites:
3. Add this page as your favorites. (Press Ctrl+D)