iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register

Go Back   WebForumz.com > Resources > Tips & Tricks > (X)HTML & CSS
Register All Albums Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Author


karinne
Karinne Legault is a Programmer Analyst working in Federal Government in Canada now working on .NET projects which she is still trying to get to grips with.

Her passion however is Web Design where she has 10 years experience. In the early years, just getting to grips with the movement of Web Standards being an integral part of the services she offers. You can view her portfolio site at KarinneLegault.com

RSS Feed

Your Options
How to Create Different backgrounds for each HTML page using CSS?

This tutorial shows you how to use CSS to make every page have a different background colour.
Here's how you do it:

Your html on the homepage would look like this.

<body class="home">
<div id="wrapper">
Content goes here
</div>
</body>
</html>

The CSS for the homepage would look like this:

body.home {
margin: 0 auto;
background: #FFFFFF ;
width: 785px;
}

So your homepage has a nice crisp white background to it!

To change the background on another page to have an image!

I want my portfolio page to have a blue patterned background. To accomplish this here is what you do.

The HTML for the portfolio page would look like this.

<body class="home">
<div id="wrapper">
Content goes here
</div>
</body>
</html>

The CSS looks like this:

body.home {
margin: 0 auto;
background: url('bluepattern.gif') repeat 0px 0px;
width: 785px;
}

By assigning a class to each <body> you now have the freedom to custom style each page background!

Enjoy!


Related Resources

Members's Comments No Comments. Be the first to comment on and rate this resource.


Search Engine Optimization by vBSEO 3.2.0 RC8