Skip to content
Loading
Bootstrap: How to navbar fixed ?  
  •     class="col-md-4">   
  •       

    fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.

      
  •       

    fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.

      
  •       
  •     class="col-md-4">   
  •       

    fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.

      
  •       

    fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.

       
  •       
  •     
  •   
  •   
  • Scroll this page to see the effect

      
  •   
  •   
  •  
  •  
    Affix type: 
    https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_affix&stacked=h
     
    1.   
    2.   
    3.   
    4.   Bootstrap Example  
    5.   "utf-8">  
    6.   "viewport" content="width=device-width, initial-scale=1">  
    7.   "stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">  
    8.   "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">  
    9.   "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">  
    10.     
    11.   
    12.   
    13.   
    14. class="container-fluid" style="background-color:#F44336;color:#fff;height:200px;">  
    15.   

      Bootstrap Affix Example

        
    16.   

      Fixed (sticky) navbar on scroll

        
    17.   

      Scroll this page to see how the navbar behaves with data-spy="affix".

        
    18.   

      The navbar is attached to the top of the page after you have scrolled a specified amount of pixels.

        
      
  •   
  • class="navbar navbar-inverse" data-spy="affix" data-offset-top="197">  
  •   class="nav navbar-nav">  
  •     class="active">"#">Basic Topnav
  •   
  •     
  • "#">Page 1
  •   
  •     
  • "#">Page 2
  •   
  •     
  • "#">Page 3
  •   
  •     
  •   
  •   
  • class="container-fluid" style="height:1000px">  
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   

    Some text to enable scrolling

      
  •   
  •   
  •   
  •  
  •  
    0
  • please refer below link:
     
    https://getbootstrap.com/docs/3.3/examples/navbar-fixed-top/
     
    https://getbootstrap.com/docs/4.0/components/navbar/ 
     
    Tank you!
    0