Forum Moderators: open

Message Too Old, No Replies

Should I use position:fixed?

which browsers won't understand it?

         

Mo the Monkey

8:05 am on Feb 10, 2006 (gmt 0)

10+ Year Member



I've been experimenting with the attribute position:fixed for the navigation element on the page. I have placed a div containing a vertically-ordered navigation menu in the top left-hand corner of the page. This div has its position fixed in the window. The rest of the page uses a simple layout with a margin big enough to contain the navigation element. So when I scroll down the page the navigation element always stays on-screen, but never covers up any of the content. It's like using frames without the disadvantages.

I've tested this with many browsers on Mac: in every case it works correctly. It also works correctly with Firefox on Windows. Internet Explorer on Windows doesn't recognise the position "fixed", but in this case this isn't so bad. The position attribute is just ignored and IE places the div in the top left-hand corner of the screen, which is where it is positioned it anyway (if you haven't scrolled down the page). This means that when the page is opened in IE, it looks just as it does in the other browsers; it's just that when you scroll down the page, the navigation div disappears upwards like any absolutely positioned element. So the page is perfectly usable in IE, you just don't get the added benefit of the navigation links always staying on-screen.

So now my questions:

I've read that using position:fixed is Not a Good Thing, that I shouldn't do it, etc. etc. In this particular case, what are the possible dangers? Are there browsers that might not display the element at all? Or will any browser that can't understand position:fixed just ignore it and place the element in the top left-hand corner, as does IE for Windows?

DrDoc

8:18 am on Feb 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [WebmasterWorld.com]

Most browsers understand (and implement) fixed positioning properly.
It's just IE/Win that has issues (as always).
But, if you (and your visitors) can live with the difference in rendering between IE/Win and "good" browsers, I don't see a reason for not using fixed positioning as it will work as expected in other browsers.

tedster

5:42 pm on Feb 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are there browsers that might not display the element at all?
Or will any browser that can't understand position:fixed just ignore it

It just gets ignored.

Mo the Monkey

4:03 pm on Feb 12, 2006 (gmt 0)

10+ Year Member



Many thanks for the advice: you give me the confidence to go ahead as planned.