Answers for "sticky header"

CSS
3

sticky header

nav {
    position: sticky; top: 0;
}
Posted by: Guest on September-19-2021
7

stick menu bar in css

.navigation {
   /* fixed keyword is fine too */
   position: sticky;
   top: 0;
   z-index: 100;
   /* z-index works pretty much like a layer:
   the higher the z-index value, the greater
   it will allow the navigation tag to stay on top
   of other tags */
}
Posted by: Guest on July-30-2020
-1

how to scroll fixed position

.fixed-content {
    top: 0;
    bottom:0;
    position:fixed;
    overflow-y:scroll;
    overflow-x:hidden;
}
Posted by: Guest on June-20-2020
0

sticky header on scroll

*****************HTML****************

<div class="sticky"></div>


*****************CSS****************

.fixed {
    position: fixed;
    top:0; left:0;
    width: 100%; }
    
    
******************jQuery***************

$(window).scroll(function(){
  var sticky = $('.sticky'),
      scroll = $(window).scrollTop();

  if (scroll >= 100) sticky.addClass('fixed');
  else sticky.removeClass('fixed');
});
Posted by: Guest on September-07-2021
0

html how to ensure that the header always on top

#header {
  position: fixed;
}

#content {
  margin-top: 100px;
}
Posted by: Guest on July-18-2020

Browse Popular Code Answers by Language