views:

1836

answers:

2

I know that position:fixed; was not supported by IE until IE 7, and it only works in IE 7 if you have a STRICT DOCTYPE.

My question is: "How do I get it work with IE 7 with TRANSITIONAL DOCTYPE?"

Please don't suggest changing a DOCTYPE, as this does not answer my question, thank you.

A: 

Try a method for emulating position:fixed that worked with IE6.

I believe this one works well: http://tagsoup.com/cookbook/css/fixed/

I'm not sure if IE8 supports position:fixed with the transitional doctype; if so, you'll have to use conditional comments to give IE8 the normal code.

exclipy
+2  A: 

You don't need a Strict DOCTYPE for fixed support. You only need a DOCTYPE that triggers Standards Mode (or ‘almost standards’). That can be a transitional doctype such as:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;

or XHTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

as long as the system ID (the URI at the end) is included.

If your pages really are relying on Quirks Mode (ugh!), I'm sorry but you cannot use fixed and will have to resort to JavaScript hacks (but then you might need those for IE6 anyway).

bobince