Have a simple site I'm helping a friend with: www.clearcomms.net
And have a newbie question.
I wanted to have the background image change based on the page visited.
So I created these classes based on my html pages:
/* Various classes */
.company { }
.auto { }
.building { }
.video { }
.automation { }
.contact { }
Identified each html document in the body tag:
<body class="auto">
Then changed the CSS to match body class with background image:
#desc {
height:200px;
color:#ffffff;
padding:0;
background:#505050 url(images/ccopen4.jpg) top left no-repeat;
clear:both;
margin:5px 0 15px 0;
}
body.company div#desc {background-image: url(images/robbg.jpg); }
body.auto div#desc {background-image: url(images/autobg.jpg); }
body.building div#desc {background-image: url(images/buildingbg.jpg); }
body.video div#desc {background-image: url(images/videobg.jpg); }
body.automation div#desc {background-image: url(images/automationbg.jpg); }
body.contact div#desc {background-image: url(images/concourse.jpg); }
And it all seems to work. www.clearcomms.net
My question is this: IS there a better or more efficient way of doing this?
It 'seems' the page loads a little slower, but it may be my imagination.
Thanks in advance on any help,
Paul



Reply With Quote



Bookmarks