DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Serg has posted 8 posts at DZone. View Full User Profile

CSS: Background-image

09.24.2010
| 3575 views |
  • submit to reddit
        Description
It determines background image for the element. If the background color is specified for the element at the same time it will be shown while the background image will have been downloaded fully. The same will happen if the image is inaccessible or their demonstration in the browser is switched off. When there are transparent areas in the image you can see the background color through them.
The usage of it at <a href=http://oheon.com/>free web templates</a>
 
Syntax

background-image: url(path to the file) | none

Arguments
Path to the graphic file is a value which is indicated inside the construction “url()”.You can write the file path either in quotation marks (double or single) or without them. The argument can have the value “none” if the background image is not necessary.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
 <title>background-image</title>
 <style type="text/css">
  BODY {
   background-image: url(images/bg.jpg); /* Path to the background image */
   background-color: #c7b29a; /* Background color */
  }
 </style>
 </head>
 <body>
  <p>...</p>
 </body>
</html>