473,387 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

IE6 bug vs. Code Problem

ram

Hi . . .

I'm new to CSS, and have just started laying out my first table-free
site; it's been both frustrating and rewarding.

I've come across something that renders okay in Firefox/Opera, but not
IE6 (gasp, shock, amazement) -- but I'm not sure if there's something
wrong with what I'm doing, as I'm pretty new at this. I haven't been
able to find the problem I'm having described elsewhere in the lists of
IE6 bugs.

Anyhow, here's how to duplicate the problem:

<html>
<head>
<style>

#test {color:green;}
#test.apple {color:red;}
#test.banana {color:yellow;}

</style>
</head>

<body>
<div id="test">TEST</div-- renders okay (green)
<div id="test" class="apple">TEST</div-- renders okay (red)
<div id="test" class="banana">TEST</div-- DOESN'T WORK in IE6 (green)
</body>

</html>

Am I doing something wrong?

Nov 17 '06 #1
18 1607
Els
ram wrote:
Hi . . .

I'm new to CSS, and have just started laying out my first table-free
site; it's been both frustrating and rewarding.

I've come across something that renders okay in Firefox/Opera, but not
IE6 (gasp, shock, amazement) -- but I'm not sure if there's something
wrong with what I'm doing, as I'm pretty new at this. I haven't been
able to find the problem I'm having described elsewhere in the lists of
IE6 bugs.

Anyhow, here's how to duplicate the problem:

<html>
<head>
<style>

#test {color:green;}
#test.apple {color:red;}
#test.banana {color:yellow;}

</style>
</head>

<body>
<div id="test">TEST</div-- renders okay (green)
<div id="test" class="apple">TEST</div-- renders okay (red)
<div id="test" class="banana">TEST</div-- DOESN'T WORK in IE6 (green)
</body>

</html>

Am I doing something wrong?
No, it really is a bug, the "IE6 multi-class bug":
http://sonspring.com/index.php?id=102

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Nov 17 '06 #2

ram wrote:
Hi . . .

I'm new to CSS, and have just started laying out my first table-free
site; it's been both frustrating and rewarding.
[...]
<body>
<div id="test">TEST</div-- renders okay (green)
<div id="test" class="apple">TEST</div-- renders okay (red)
<div id="test" class="banana">TEST</div-- DOESN'T WORK in IE6 (green)
</body>

</html>

Am I doing something wrong?
Your HTML is invalid, IDs must be unique in the document.

--
Fred

Nov 17 '06 #3
ram

Thanks for your help -- it's good to know that it's an identified bug.
I ended up using the same workaround recommended on the link above.

The code I posted was actually just to duplicate the problem; the real
html has only one div with the id, and the class is changed with
javascript -- same difficulty arises.

After spending the day trying to code with CSS, I have a whole new
appreciation of why designers dislike IE6 so much.

Thanks again.

Fred wrote:
ram wrote:
Hi . . .

I'm new to CSS, and have just started laying out my first table-free
site; it's been both frustrating and rewarding.
[...]
<body>
<div id="test">TEST</div-- renders okay (green)
<div id="test" class="apple">TEST</div-- renders okay (red)
<div id="test" class="banana">TEST</div-- DOESN'T WORK in IE6 (green)
</body>

</html>

Am I doing something wrong?

Your HTML is invalid, IDs must be unique in the document.

--
Fred
Nov 17 '06 #4
Els
Fred wrote:
ram wrote:
>Hi . . .

I'm new to CSS, and have just started laying out my first table-free
site; it's been both frustrating and rewarding.
[...]
><body>
<div id="test">TEST</div-- renders okay (green)
<div id="test" class="apple">TEST</div-- renders okay (red)
<div id="test" class="banana">TEST</div-- DOESN'T WORK in IE6 (green)
</body>

</html>

Am I doing something wrong?

Your HTML is invalid, IDs must be unique in the document.
Can't believe I missed that! :-(

It's not the cause of the problem though, if you take out the first
two elements with id="test", the 3rd one still won't show as yellow.

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Nov 17 '06 #5

Els wrote:
Am I doing something wrong?
Yes - as Fred said, id has to be unique in your HTML.
No, it really is a bug, the "IE6 multi-class bug":
http://sonspring.com/index.php?id=102
I don't believe this is a bug, and if it is then it would be better
titled the "You can't re-use id" bug

Id has to be unique, and IE's quite reasonable error-correction
behaviour is to throw away duplicate ids as if they'd never been there.
FF's equally reasonable behaviour is to treat id as attributional not
ordinal and work with the duplicates as much as possible. Once you
realise the different behaviours of how the two browsers build a DOM
from this invalid document, then the resultant CSS behaviour is
obvious.

The fix is to not duplicate id in HTML.

The best practice is to work CSS by using class, not by using id
(frequently discussed in the past). You don't need id here, and
typical work with CSS is easier by using class instead and alone.
Leave id to when you need DHTML or document fragment identifiers.

Nov 17 '06 #6
Els
Andy Dingley wrote:
Els wrote:
>>Am I doing something wrong?

Yes - as Fred said, id has to be unique in your HTML.
That is true, but it is not the cause of the problem in this case.
>No, it really is a bug, the "IE6 multi-class bug":
http://sonspring.com/index.php?id=102

I don't believe this is a bug, and if it is then it would be better
titled the "You can't re-use id" bug
No, one stylesheet can be used for more than one page. There is no
rule that there can't be any double rulesets for the same ID in the
CSS file. Did you read the link at the above mentioned URL?

This bug shows up if you have 3 separate pages, each with an element
with the same ID, but with a different class. It is definitely a bug.

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Nov 17 '06 #7
Els <el*********@tiscali.nlwrites:
No, one stylesheet can be used for more than one page. There is no
rule that there can't be any double rulesets for the same ID in the
CSS file.
Yes, but there *is* a rule against re-using the same ID in the same
HTML page.
This bug shows up if you have 3 separate pages, each with an element
with the same ID, but with a different class.
But that wasn't the test case. The test case had elements with the same
ID all on one page.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Nov 17 '06 #8
Els
Sherm Pendley wrote:
Els <el*********@tiscali.nlwrites:
>No, one stylesheet can be used for more than one page. There is no
rule that there can't be any double rulesets for the same ID in the
CSS file.

Yes, but there *is* a rule against re-using the same ID in the same
HTML page.
I didn't say there isn't.
>This bug shows up if you have 3 separate pages, each with an element
with the same ID, but with a different class.

But that wasn't the test case. The test case had elements with the same
ID all on one page.
I *know*. (and I've mentioned that in two different messages in this
thread already, after missing it in my first reply). As I said: it's
true that that example HTML was wrong in re-using the ID, but it is
*not* the cause of the problem. The cause of the problem is the
documented multi-class bug.

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Nov 17 '06 #9
Els <el*********@tiscali.nlwrites:
Sherm Pendley wrote:
>Els <el*********@tiscali.nlwrites:
>>No, one stylesheet can be used for more than one page. There is no
rule that there can't be any double rulesets for the same ID in the
CSS file.

Yes, but there *is* a rule against re-using the same ID in the same
HTML page.

I didn't say there isn't.
Straw man. I didn't claim you said that. I pointed out that your "there is
no rule" isn't relevant to the test case.
I *know*. (and I've mentioned that in two different messages in this
thread already, after missing it in my first reply).
People don't always receive articles to their server in the same order you
write them. Welcome to usenet.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Nov 17 '06 #10
Els
Sherm Pendley wrote:
Els <el*********@tiscali.nlwrites:
>Sherm Pendley wrote:
>>Els <el*********@tiscali.nlwrites:

No, one stylesheet can be used for more than one page. There is no
rule that there can't be any double rulesets for the same ID in the
CSS file.

Yes, but there *is* a rule against re-using the same ID in the same
HTML page.

I didn't say there isn't.

Straw man. I didn't claim you said that. I pointed out that your "there is
no rule" isn't relevant to the test case.
See below.
>I *know*. (and I've mentioned that in two different messages in this
thread already, after missing it in my first reply).

People don't always receive articles to their server in the same order you
write them. Welcome to usenet.
Is that your apology?
It's you who snipped the part I was replying to, and added in your
mind an earlier reply that had a test case. It's not me who replied to
separate messages, combining them and drawing conclusions.

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Nov 17 '06 #11
Els <el*********@tiscali.nlwrites:
Sherm Pendley wrote:
>People don't always receive articles to their server in the same order you
write them. Welcome to usenet.

Is that your apology?
Hell no, it's not an apology. I don't owe you one.
It's you who snipped the part I was replying to, and added in your
mind an earlier reply that had a test case.
The original post had a test case, to which your comment wasn't the slightest
bit relevant. Whining about imagined insults won't change the fact that you
were wrong. Deal with it.

Or just keep whining about it - I honestly don't care, since I won't see any
more of your posts anyway.

*plonk*

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Nov 17 '06 #12

Els wrote:
This bug shows up if you have 3 separate pages, each with an element
with the same ID, but with a different class. It is definitely a bug.
You're right - it's a bug. I didn't find the describe on that site
especially well written and I didn't fire up IE just to see their
example. I never realised IE was so broken as to persist ids across
separate pages!

Nov 17 '06 #13
In article <m2************@Sherm-Pendleys-Computer.local>,
Sherm Pendley <sp******@dot-app.orgwrote:
Els <el*********@tiscali.nlwrites:
Sherm Pendley wrote:
People don't always receive articles to their server in the same order you
write them. Welcome to usenet.
Is that your apology?

Hell no, it's not an apology. I don't owe you one.
It's you who snipped the part I was replying to, and added in your
mind an earlier reply that had a test case.

The original post had a test case, to which your comment wasn't the slightest
bit relevant. Whining about imagined insults won't change the fact that you
were wrong. Deal with it.

Or just keep whining about it - I honestly don't care, since I won't see any
more of your posts anyway.

*plonk*

sherm--
Sherm, you are a big fat fool! A schmuck. A Shit of the First
Waters (whatever the hell this means, an expression that my old
pappa used to use; admit it sherm, it sure sounds good, huh?).
The multiple ids had nothing to do with it. Els went straight to
the heart of the matter, and had she noticed the
less-important-in-the-context mistake in the OP's markup, this
might have thrown her off plonking her arrow right on target.

--
dorayme
Nov 17 '06 #14
dorayme <do************@optusnet.com.auwrites:
Sherm, you are a big fat fool!
Do you seriously expect me to listen to you when you begin with that?

*plonk*

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Nov 17 '06 #15
In article <m2************@Sherm-Pendleys-Computer.local>,
Sherm Pendley <sp******@dot-app.orgwrote:
dorayme <do************@optusnet.com.auwrites:
Sherm, you are a big fat fool!

Do you seriously expect me to listen to you when you begin with that?

*plonk*

sherm--
HEY SHERM! I KNOW YOU CAN HEAR WHEN I SHOUT! I DEVELOPED THE
TECHNIQUE DURING A LONG PERIOD OF INCARCERATION IN BdeZ's
KILLFILE.

--
dorayme
Nov 17 '06 #16
Els
Andy Dingley wrote:
Els wrote:
>This bug shows up if you have 3 separate pages, each with an element
with the same ID, but with a different class. It is definitely a bug.

You're right - it's a bug. I didn't find the describe on that site
especially well written
Yup, agree with that. It's just that I learned about this bug on the
css-d list, and when trying to find the documentation, all those links
seemed to point to this one page, so I didn't have much choice :-)
and I didn't fire up IE just to see their
example. I never realised IE was so broken as to persist ids across
separate pages!
Me neither (before I heard about this bug), but I can't say I'm really
surprised ;-)

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Nov 17 '06 #17
Els
dorayme wrote:
In article <m2************@Sherm-Pendleys-Computer.local>,
Sherm Pendley <sp******@dot-app.orgwrote:
>*plonk*

sherm--

HEY SHERM! I KNOW YOU CAN HEAR WHEN I SHOUT! I DEVELOPED THE
TECHNIQUE DURING A LONG PERIOD OF INCARCERATION IN BdeZ's
KILLFILE.
<g>

--
Els http://locusmeus.com/
accessible web design: http://locusoptimus.com/
Nov 17 '06 #18
ram wrote:
>
Hi . . .

I'm new to CSS, and have just started laying out my first table-free
site; it's been both frustrating and rewarding.

I've come across something that renders okay in Firefox/Opera, but not
IE6 (gasp, shock, amazement) -- but I'm not sure if there's something
wrong with what I'm doing, as I'm pretty new at this. I haven't been
able to find the problem I'm having described elsewhere in the lists
of IE6 bugs.

Anyhow, here's how to duplicate the problem:

<html>
<head>
<style>

#test {color:green;}
#test.apple {color:red;}
#test.banana {color:yellow;}

</style>
</head>

<body>
<div id="test">TEST</div-- renders okay (green)
<div id="test" class="apple">TEST</div-- renders okay (red)
<div id="test" class="banana">TEST</div-- DOESN'T WORK in IE6
(green) </body>

</html>

Am I doing something wrong?
Try to validate the page. An id should only be used once in a page.

--
David Woods
Nov 18 '06 #19

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
8
by: Paul Cochrane | last post by:
Hi all, I've got an application that I'm writing that autogenerates python code which I then execute with exec(). I know that this is not the best way to run things, and I'm not 100% sure as to...
8
by: Steve Jorgensen | last post by:
Hi folks, I'm posting this message because it's an issue I come up against relatively often, but I can't find any writings on the subject, and I haven't been able to figure out even what key...
2
by: Praveen K | last post by:
I have a problem in communicating between the C# and the Excel Interop objects. The problem is something as described below. I use Microsoft Office-XP PIA dll’s as these dll’s were been...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
8
by: Andy B | last post by:
Before I do a no no on a newsgroup, I need to ask a question: What is the max number of lines of code you can/should post here before it gets too long?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.