r/HTML • u/Dauntle55Duck • 28d ago
Question Menu code repetition
Should I look for a way to call an external html page with the code for my menu? I feel like adding the code to every page might clutter the code a bit. It’s been a while and I don’t remember wether or not we discussed this in school lol
6
Upvotes
View all comments
2
u/Weekly_Ferret_meal 28d ago
OR if the option of servers or JS isn't there. you can go old school and use iframe.
the index.html contains the main page with the menu that targets the a content iframe to load the pages like home.html, about, contact, etc...
https://www.w3schools.com/html/tryit.asp?filename=tryhtml_iframe_target
That's how I built my first website.
It's old school, but it's still valid.