Domanda

I'm building a small personal website and would like to know how to make a sticky menu in HTML/CSS And JS without using JQuery (because I don't want to include it for such a small use) like this one

Thanks :)

È stato utile?

Soluzione

I assume with 'sticky' you mean a mean staying on top (over) your content and being visible regardless of view port (scrolling state). This can be done by using position: fixed; top: 0; left: 0; with: 100% on the menu's container. The important thing is position: fixed; it makes sure the menu stays where it is...

Did I guessed this correct?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top