CSS: Using ID's and classes on the same object?

Soldato
Joined
20 Oct 2002
Posts
18,988
Location
London
Is this possible?

http://www.touchlinetactics.co.uk/unlive/index.php - I'd like the photo (which is a background) to change on each page, so was thinking of changing the div's CSS from:

Code:
#content #header-left {
	float: left;
	margin-top: 25px;
	margin-bottom: 25px;
	width: 332px;
	height: 248px;
	border: 1px solid #4f4f4f;
	background: #fffff0 url(img/header-left01.jpg) no-repeat scroll center;
	}

to something like

Code:
#content #header-left {
	float: left;
	margin-top: 25px;
	margin-bottom: 25px;
	width: 332px;
	height: 248px;
	border: 1px solid #4f4f4f;
	}

#content .header-left-01 {
background: #fffff0 url(img/header-left01.jpg) no-repeat scroll center;
}

#content .header-left-02 {
background: #fffff0 url(img/header-left02.jpg) no-repeat scroll center;
}

etc.

And in the HTML:

Code:
<div id="header-left" class="header-left-01"></div><!--/header-left-->

But it doesnt seem to want to play ball. :confused:

Any ideas? I'd be interested in using a random image from a set, but i dont think thats possible when using CSS to set the images as backgrounds?

EDIT: Yeah i know i could just copy the whole #header-left and modify it slightly, but that doesnt seem to work either so :p Go figure!
 
Last edited:
Hmn confusing. Yes i screwed up in my first post with the {'s. (fixed now, wasn't in my CSS)

I dunno why i do #content #main #right or whatever, i think its just something i picked up! :confused:

Thanks guys, i'll give it a go tomorrow morning when i'm a bit more with it. :)
 
Back
Top Bottom