Itay Moav -Malimovka
Itay Moav -Malimovka

Reputation: 53607

Is there a pure CSS way to have a bar stay on the same place?

Similar to some Facebook feature, like the Chat link, that stays constantly at the same place of the page, regardless if you scroll.
Is there a simple pure CSS way to achieve this?
Here is a very simplistic HTML:

<div id='constant-bar'> some background some text</div>
<p>content</p>
<p>content</p>
<p>content</p>
.... X 1000
<p>content</p>

I really care right now for IE>8 and FF > 5 and chrome, Safari latest versions. My code will be released only some time from today

Upvotes: 0

Views: 124

Answers (2)

Levi Morrison
Levi Morrison

Reputation: 19552

Research position:fixed

It is not supported on many mobile browsers at the moment, and older Internet Explorer versions (IE<7) don't support it either. Additionally, IE 7 has a strange bug.

If you want it to stretch the full height of the page, you'll also have to look into that too. This tutorial might help.

Upvotes: 4

Joe
Joe

Reputation: 82634

look into the CSS attribute fixed:

position: fixed;

Example

Upvotes: 4

Related Questions