The best solution is to use SSI (Server Side Includes), but this requires PHP. If you do not have PHP, the likelihood of being able to use SSI is practically none.
To use this option
1. create an include file called nav.php - actually, the extension can be anything including html and txt. I tend to use nav.inc.php.
<ul> <li><a href="index.php">Home</a></li> <li><a href="services.php">Services</a></li> <li><a href="about.php">About</a></li> </ul> |
2. include the file into your main document e.g. index.php
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php include 'nav.php'; ?> <div> content goes here </div> </body> </html> |
The next best option is to use JS (JavaScript).
1. create an include file called nav.js
document.getElementById("navMenu").innerHTML = '<ul>'+ '<li><a href="index.html">Home</a></li>'+ '<li><a href="services.html">Services</a></li>'+ '<li><a href="about.html">About</a></li>'+ '</ul>'; |
2. include the file into your main document e.g. index.html
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <nav id="navMenu"></nav> <div> content goes here </div> <script src="nav.js"></script> </body> </html> |
A last option is to use an IFRAME as in HTML Iframes. I will not expand on this because it comes will all sorts of adjustments.