IE6 and a CSS thing I've not seen before!

Sic

Sic

Soldato
Joined
9 Nov 2004
Posts
15,365
Location
SO16
So, I've got a fairly nice little CSS layout going on right now, I shan't bore you with the details of how it works perfectly in decent browsers, you all know it does! IE6 doesn't appear to like me sharing class names on elements, which is really stupid!

markup:
Code:
<div class="colourbox orange">
	<img src="lib/img/orange/vehicleplates.gif" class="title"/>
	<img src="lib/img/productvehicleplates.jpg" class="product"/>
	<ul>
		<li>Customise Your Vehicle</li>
		<li>Great quality and great designs.</li>
	</ul>
	<form action="" method="get">
		<ul>
			<li><label>Search</label></li>
			<li><input type="text" name="search" class="noborder"/></li>
			<li><input type="image" class="image" src="lib/img/orange/search.gif"/></li>
		</ul>
	</form>
	<div class="button orange">
		<a href="#" class="create"><span class="hidden">Create My Plates</span></a>
	</div>
</div>

css:
Code:
/**box*/
div.colourbox {
	float: left;
	width: 173px;
	height: 277px;
	padding-right: 7px;
	background-repeat: no-repeat;
	background-position: left top;
	margin-right: 10px;
}
div.colourbox.orange {
	background-image: url(../img/orange/orangebg.png);
}
div.colourbox img.title {
	margin: 9px 0 0 7px;
}
div.colourbox img.product {
	margin: 3px 0 0 1px;
}
div.colourbox ul {
	margin: 14px 9px 0 8px;
	width: 154px;
	height: 78px;
	max-height: 78px;
}
div.colourbox ul li {
	color: #fff;
	padding: 0 0 0 17px;
	font-size: 0.9em;
	background-repeat: no-repeat;
	background-position: 0px 0px;
	line-height: 1.2;
}
div.colourbox.orange ul li {
	background-image: url(../img/orange/tick.gif);
}
div.colourbox.orange ul>li:nth-of-type(2) {
	margin-top: 30px;
}
div.colourbox form {
	margin: 0 !important;
}
div.colourbox form ul {
	overflow: hidden;
	margin: 7px 0 0 1px !important;
	height: auto;
	width: 171px;
}
div.colourbox form ul li {
	float: left;
	background-image: none !important;
	margin: 0 !important;
	padding: 0 !important;
}
div.colourbox form label {
	margin: 3px 15px 0 7px;
	display: block;
	font-size: 0.9em;
	color: #fff;
}
div.colourbox form input.noborder {
	margin: 2px 15px 0 0;
	width: 80px;
	font-size: 0.7em;
	border: none;
	background: none;
}
div.colourbox form input.image {
	margin-top: 1px;
}
/**button*/
div.button {
	height: 28px;
	max-height: 28px;
	overflow: hidden;
}
div.button a {
	background-repeat: no-repeat;
	background-position: center 8px;
	display: block;
	padding: 14px 0;
	float: left;
}
div.colourbox div.button {
	margin: 13px auto;
}
div.button.orange {
	background: url(../img/orange/button.png) no-repeat top left;
	width: 115px;
}
div.button.orange a.create {
	background-image: url(../img/orange/createmyplates.png);
	width: 115px;
}

how it should look:
20080625-mr4hp7yryujga4n8uwx3ngu5dr.jpg


how it looks in IE6
20080625-ntxq8j7kqerud3ftkks2qkyedf.jpg


as you can see, the button has adopted the background of its parent, which shares its class name (they share class names to ease my memory!). This isn't an issue in IE7, which is nice.

Has anyone come across this before? Is it not possible to nest and share classnames like this in IE6? Am I in the wrong here, semantically, should the classnames be different even though they're really only being used as identifiers? It's obviously not an issue to change the names around (mild pain), but I've not seen this behaviour before and I thought it notable.
 
oh is that what it is? weird that I've not come across any problem with it til now, it's something I use all the time!
 
yeah, but IE doesn't like you using selectors like div.foo.bar, which was quite annoying.

I've had a whole 3 days of CSS and it's been really fun :D
 
In my new job, I've been allowed to do it way more - I used to be a strictly PHP/MySQL person, but now I get to do loads of HTML, CSS and Javascript as well.

I'm assuming you're not being sarcastic, but I've been wrong before!
 
heh, no I love that sort of thing - I'm an anally retentive perfectionist at the moment and CSS seems to be feeding it quite nicely. Like I said, I use multiple stylesheets so I don't have to use hacks, it's the least frustrating way of doing things imho
 
Back
Top Bottom