html tutorial - How to create fixed header or footer using CSS - html5 - html code - html form

Answer: Use CSS fixed positioning

    You can simply produce sticky or fixed header and footer victimization the CSS fixed positioning. simply apply the CSS position property with the worth fixed together with the highest and bottom property to position the element on the highest or bottom of the viewport consequently.


      <!DOCTYPE html>
      <html lang="en">
      <meta charset="utf-8">
      <title>Implement Sticky Header and Footer with CSS</title>
      <style type="text/css">
          /* Add some padding on document's body to prevent the content
          to go underneath the header and footer */
              padding-top: 70px;
              padding-bottom: 50px;
          .fixed-header, .fixed-footer{
              width: 100%;
              position: fixed;        
              background: #333;
              padding: 10px 0;
              color: #fff;
              top: 0;
              bottom: 0;
              width: 90%;
              margin: 0 auto; /* Center the DIV horizontally */
          nav a{
              color: #fff;
              text-decoration: none;
              padding: 7px 25px;
              display: inline-block;
          <div class="fixed-header">
              <div class="container">
                      <a href="#">Home</a>
                      <a href="#">About</a>
                      <a href="#">Products</a>
                      <a href="#">Services</a>
                      <a href="#">Contact Us</a>
          <div class="container">
              <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit...</p>
          <div class="fixed-footer">
              <div class="container">Copyright © 2017 Your Company</div>        

      Related Searches to How to create fixed header or footer using CSS