make the header stay

The menu bar that appears to follow you is a popular trick on most websites nowadays and actually really easy to do in CSS.

First, figure out what component you want to stay at the top of the page and in its css attributes, I’ll use the header for example.

make sure in HTML you use <div class= “header”> and not simply the <header> tag

Image

 

setting the position to “fixed” means that it stays put on the page. After that, voila! your header stays atop the page no matter how long you scroll.

Image

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s