htmlheaderglobalfooter

Global header and footer in HTML


I have an website and I want to all pages have same header and footer, a global header and footer. I want to edit footer/header for all pages in same tame. How can I do this?


Solution

  • If your site in php you can write something like this:

    Index.php

    <?php 
    include 'header.php';
    ?>
    <div class="container">
        Text
    </div>
    <?php 
    include 'footer.php';
    ?>
    

    Header.php

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <title>Title</title>
        <meta name="description" content="">
        <meta name="keywords" content="keywords">
        <link rel="stylesheet" href="css/style.css">
        <script src="js/custom.js"></script>
        <link rel="shortcut icon" href="img/favicon.ico">
        <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    </head>
    <body>
        <header>
    
        </header>
    

    Footer.php

        <footer>
    
        </footer>
     </body>
     </html>