I've tried looking for this on here and on google but I haven't really found an answer to this specific question and I'm not sure if there's something - a term or something that I need to look for, so I apologize if this is a commonly asked question.
Either way, let's say for example that I'm building a website with many sections and I wanted these sections to be modular, so each section is it's own html file. So basically I could include this little module anywhere I want on the main html file or maybe I could simply include navbars and footers onto other HTML pages without having to rewrite lines of code.
Is this possible with just HTML alone?
What you can do is create a php file where you write the html code, and in the index.php call that same file. For exemple:
Tis is your index .php and the file footer.php is the other file with the html that you want.
<html>
<body>
<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<?php include 'footer.php';?>
</body>
</html>
Or
you can also create an iframe, give it a specific size, in your html file and in the src, you can refer to the html file that you want
<iframe src="../../something.html"></iframe>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With