I've been a front end developer for a while now and though I've spent a good while googling and fiddling I've never gotten to the bottom of figuring out a particular quirk of ie6.
It seems that in certain circumstances ie6 will render the last few characters of a piece of text again. I don't have a live example but I'll try to illustrate my point through the medium of the text editor.
Imagine you had an a tag (in my experience this usually occurs in a tags or inputs) in a div or p tag containing text: ___________ |this is text | ----------
ie6 sometimes takes it upon itself to display the last few characters again under that container
___________ |this is text | ----------
xt
The only way I have managed to counteract this is by putting redundant html under the container, which seems to reduce the excess text.
I was wondering if anybody had experienced anything similar and whether or not there is a more semantic approach to dealing with it.
Hi Ninjabiscuit, I have faced it before... try removing comments one by one from your HTML page. This may sound idiotic... but it works... Please don't ask the reason
It absolutely works. I removed all the comments from the page and now the errant text has gone. It's good to know I'm not the only one who has been tearing my hair out over this one. Thanks Kesav, you're a genius!
I'd still like to know the origin of this little oddity though, and whether or not it has a name. Any ideas?
Update: I noticed this bug again on some work I'm doing at the moment, but this time it wasn't caused by comments. As noted by Position Is Everything, the bug can also be caused by elements not having Layout.
So, the fix I found to work was to apply
display:block;
to give the element Layout. Simple.
Hopefully this will be of use to anyone else who still encounters it after removing comments.
To my knowledge with the bug, it's caused by floats not closed properly. After you are done with your floats (say images in a line) have a <div style="clear:both;height:0px;overflow:hidden"></div> for good measure. But I'm 100% sure it's caused by floats.
kari.patila is correct... he says not to use empty elements ... He means do not add a tag just to set clear both. Use the existing element next to the floated element.