Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with multiple classes in IE

Status
Not open for further replies.

ronnie98

Technical User
Aug 5, 2004
36
IT
Hi all,
i have this code
Code:
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en" lang="en">
<head>
<title>12345 12345 12345 12345 12345 </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
div.firstclass.colorclass{
background-color: #000000;
color: yellow;
}

div.secondclass.colorclass{
background-color: #cccccc;
color: red;
}
</style>
</head>
<body>
<div class="firstclass colorclass">Some content</div>
<div class="secondclass colorclass">Some other content</div>
</body>
</html>

It behaves different in Firefox and Explorer.
From my point of view Firefox's is the right one,but why it doens't work fine in IE?
That's my problem, hope somebody can point me in the right direction or suggest an alternative solution.
Thanks in advance.
 
Thank you jeff,
but adding a doctype didn't bring any benefit,the problem remains.
The updated code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<title>12345 12345 12345 12345 12345 </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
div.firstclass.colorclass{
background-color: #000000;
color: yellow;
}

div.secondclass.colorclass{
background-color: #cccccc;
color: red;
}
</style>
</head>
<body>
<div class="firstclass colorclass">Some content</div>
<div class="secondclass colorclass">Some other content</div>
</body>
</html>
 
If you swap the order of the classes in your selectors, all works fine in both browsers.

So these:

Code:
div.firstclass.colorclass {
div.secondclass.colorclass {

become these:

Code:
div.colorclass.firstclass {
div.colorclass.secondclass {

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top