Click to See Complete Forum and Search --> : Advice for a fixed bar at the top of the page


steamPunk
01-22-2010, 03:30 AM
Hi

I need to make a bar that goes right across my site at the top of the page but doesn't scroll up when the page is scrolled - it just sits there

my first thought was to do it with javascript but I would prefer to use CSS - i seem to remember reading that position:fixed doesn't work with all browsers - is this true ?

If so, is there another way i can make this bar fixed just using CSS?

thanks for any advice you can give for this

KDLA
01-22-2010, 07:12 AM
This works in Firefox, IE7 and Chrome:

<div style="position: fixed; top: 0; width: 100%; height: 50px; background: #000; z-index: 1000; color: #fff;">test</div>
<div style="height: 2000px; background: gray;">Lorem ipsum</div>

steamPunk
01-22-2010, 09:29 AM
ok - I'll give it a test in IE6 & 8 too, just to be sure

thanks :)