View Full Version : quickie about position

12-10-2002, 06:14 PM
ho hum, I am using position: fixed which works lovely in mozilla but of course not in IE...

...but I don't want to have to use position: absolute. Neither can I allow IE to interpret position: fixed as anything other than absolute.

Is there a quick way, using CSS only, to tell IE to bog off and use absolute, while allowing mozilla to use fixed?

Cheers :)

::] krycek [::

12-10-2002, 07:37 PM
This smells like a javascript.

I wouldn't design only for low-use browsers rather the most popular in use today and anything else 2ndly. :D

12-10-2002, 07:48 PM
lol :rolleyes:

you must have missed my other threads about moz and ie :) thanks all the same :D

nah, I am just wondering if there is a simple way to do this, otherwise I will keep it to absolute. I know IE can't do fixed without JS - I said so when I posted. All I am after is an IE CSS hack, if there is one, to let IE have the absolute value, and mozilla the fixed.


::] krycek [::

12-10-2002, 08:13 PM


12-10-2002, 10:29 PM
cool, thanks beetle!!! :)

pity the bit about IE 6 doesn;t work though - but the rest does :D

::] krycek [::

12-11-2002, 05:18 AM
IE doesn't recognize some CSS selector patterns, so you could use something like:

.myAbs {
position: absolute;

.myFixed > .myAbs {

Then wrap an extra DIV tag around the element you want to position:

<div class="myFixed">
<div class="myAbs">Fixed element.</div>

"X > Y" means Y is a child element of X. You can use tag names, class names or ids or whatever for X and Y.

IE doesn't get the ">" part so it will ignore that rule and just apply the first one, making the inner DIV absolute. Mozilla will recognize the second rule, which overrides the first, making the inner DIV fixed.

12-11-2002, 03:40 PM
Krycek, if conformance is not required, you can just have the one DIV and use this:

div.fix {position:absolute}

div.fix {position:fixed}

Browsers other than IE will implement the second style, which IE ignores (using only the first style).