Jump to blog tools

July 23, 2003


It gets my vote as the single worst browser regression bug in history. If, in IE6, you attempt to select text from most absolutely positioned elements, it simply won't work. You'll end up selecting half the page, and not the text you wanted. It's very silly, seeing as how selecting text worked fine in all IE5 versions.

It occurs when you try to select text which is vertically below the end of static content (which normally means any <body> content), and only in standards-compatible mode. And when it happens, it's bloody annoying (for example, try selecting text on mezzoblue's old design).

There are two ways to fix it: don't put IE6 into standards-compatible mode using either a comment or XML prolog before the doctype, or...

<script type="text/javascript">
if (window.createPopup && document.compatMode && document.compatMode=="CSS1Compat")
  document.onreadystatechange = onresize = function fixIE6AbsPos()
    if (!document.body) return;
    if (document.body.style.margin != "0px") document.body.style.margin = 0;
    onresize = null;
    document.body.style.height = 0;
    setTimeout(function(){ document.body.style.height = document.documentElement.scrollHeight+'px'; }, 1);
    setTimeout(function(){ onresize = fixIE6AbsPos; }, 100);


Yep, it's a hack. Yep, it's ugly. Nope, I don't like it very much. But it does seem to work. If there's a page you desperately want to copy from in IE, then you could also add this favelet - Fix text selecting - to your favorites.

Oh, and on a related IE6-selecting-note, going to CSS Zen Garden's latest design and selecting the text at the top of the left bar to watch IE6 go bang. Stupid thing.

Posted at July 23, 2003 01:08 GMT


Since using mozilla firebird, and some of the myriad(!) of browser available on the linux, I now find IE disgusting and evil. Is this normal behaviour?

Posted by Swat on July 23, 2003 22:19 GMT Link to this comment

I've got to admit, I found the move from IE to Firebird quite difficult at first, and I find the form-completion crashes beyond annoying, but features such as the 'web developer' extension, and middle click to open links in new tabs are invaluable now. I just find IE slow to work with now..

Posted by Andrew Donaldson on July 24, 2003 15:43 GMT Link to this comment

of course, one other way to fix it is to try to avoid using absolute positioning in the first place -- i find this preferable to the standards-compatible mode strategy [which throws up more horrible css-related bugs in ie6!].

Posted by dvd on July 30, 2003 15:54 GMT Link to this comment

the script might be a hack, but it works. it saved my design and me a lot of headaches.

major props for somehow getting this to work.


Posted by tripp millican on November 15, 2003 08:52 GMT Link to this comment

Hello! Thanks for your sollutions.. I have the same problem and I can't stand it.. Searched for answers and I finaly found one (this URL adres was posted on the forum I asked the question on).. Just like you wrote, remove the doctype thing in top of your page and you can select the text like you can normaly.. I'll try the javascript thing too.. I find it a very strange bug.. Anyway! thanks!

Posted by bassie on January 2, 2004 20:38 GMT Link to this comment

By the way, if you want to keep your website XHTML strict, add HTML comment tags in the JavaScript part. Like this:

<script type="text/javascript">

This will prevent the javascript will give an error when trying to validate the page for XHTML strictness..

Posted by bassie on January 2, 2004 20:56 GMT Link to this comment

Would you mind explaining why this hack works? I'm not clear on what assumptions it is making. How does the body margin and the height settings make this hack effective?

Posted by Jordan on March 3, 2004 18:19 GMT Link to this comment

..and THANK YOU for developing this. It solved the issue with my site and it has saved me from pulling more hair from my head :)

Posted by Jordan on March 3, 2004 18:21 GMT Link to this comment


All the other workarounds caused problems. But this works.

Thank you!!!!

Posted by Vic on March 3, 2004 21:54 GMT Link to this comment

What terrific hack Tom--been searching for months for an answer to the problem till finally found the link to here from pvii forum
problem now fixed ----Thankyou

Posted by Sherro on March 18, 2004 23:15 GMT Link to this comment

Rock on!

I have absolutely no idea how this script works, but it's a lifesaver. Cheers, sir!


Posted by Ty on March 25, 2004 19:59 GMT Link to this comment

Sorry, new comments have been disabled.


There haven't been any trackbacks to this entry.

Blog Tools

Recent Entries

March 2004

1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31


Syndicate: RSS 1, RSS 2
Designed by Shell Design
Powered by Movable Type