Checked At:04:00
6 Guests
0 Users
Online doing the past 15 Minutes!
brugbart.com - Edition/Last Updated: 13. October 2008
Posted The: 08/09/2008 - AT: 17:35
This tutorial presume you already know about URI's and how to use them. The Article on Absolute and Relative Paths may be of help to those who dont.
The properties used when applying backgrounds are listed in the reference entry Background Properties, this tutorial covers basic usage of these.
The body element.
Applying a background on the body element will apply a background for the intire page.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>backgrounds in css</title>
<style type="text/css">
body {
background-image: url("background.jpg");
}
</style>
</head>
<body>
<h1>Change the Background using CSS.</h1>
<p>apply a background using css.</p>
</body>
</html>
Note. The above example is using embedded styles, its recommended to use External StyleSheets.
Through the use of the Background-repeat Property, you will either be able to repeat the image Horizontally (repeat-x) or Vertically (repeat-y), you can also disable the repeating (no-repeat).
<style type="text/css">
body {
background-image: url("background.jpg");
background-repeat: repeat-x;
}
</style>The default setting is repeat, which repeats the image in both diractions.
We can also lock the Background-image so it appears fixed doing scrolling, this is done through the use of the background-attachment property
<style type="text/css">
body {
background-image: url("background.jpg");
background-repeat: repeat-x;
background-attachment: fixed;
}
</style>
Paragraphs
Most elements can have a background applied, so lets change the background color on some text.
<style type="text/css">
p {
background-color: blue;
}
</style>Note. You should read about CSS Selectors to understand how to best apply your styles.
Author: BlueBoden
Comments: [0]


Checked At:04:00
6 Guests
0 Users
Online doing the past 15 Minutes!
This page was created in 0.159410953522 seconds
Welcome Guest