CSS to achieve a similar fixed floating div thast always on top of other divs - like stackoverflow does?

13,448

You need to use the position: fixed; property for #top div.

<div id="top"></div>

#top {
  position:fixed;
  top:0px;
  width:100%;
  height:70px;
}
Share:
13,448
Julio
Author by

Julio

Updated on June 07, 2022

Comments

  • Julio
    Julio about 2 years

    I'd like to achieve a similar effect as the one in this image:

    enter link description here

    Basically, I want to have a div as a menu bar that's always on top - the div beneath it being the container div for my content. Clicking any links in my menu bar only change the content in the container div.