Jump to content

Sticky headers


Maxi_Mega

Recommended Posts

Hello everyone,

 

I was searching for a technique to make an element on my html page staying at the same place even if we scroll the page.

I found 2 methods :

This one and this one.

What is the difference between these two techniques ? (apart from how it's coded)

 

Also, I have a problem with these methods : when we scroll down, it stay at the same place  - that's nice -  but the rest of the page goes in front of my sticky element and not behind, like it does on the two methods I mentioned before.

 

Have anyone an answer to my to questions ?

 

 

Thank you in advance,

 

Maxi_Mega

 

PS: Sorry for my english, I'm french :s

Link to comment
Share on other sites

If your other elements are using the property position: such as position: relative;( it should not be using position: absolute;) the header and the other element become layered, to combat this you should use the property z-index:. This has the ability to make a element layer lever higher than the next so is has higher precedence over the other elements. Give position: fixed; header z-index: 50; the others z-index: 10; this should fix this problem.

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...