Reputation: 1229
I'm trying to figure out what the norm or standard convention is. Let's say I have a website, and most pages have the same navigation bar, and same footer. Would it be better, or more efficient, to create two different HTML files then, nav.html and foot.html, and just include them into each of my web pages using
<div w3-include-HTML="nav.html"></div>
Or is it more common to just rewrite the same code over all of the pages? I understand I would need to include the JS with the 'include' method, I'm just trying to figure out the standard practices for web development.
Upvotes: 0
Views: 163
Reputation: 52
I have been working with web designing for some time, and I feel that including separate files is much better than repeating the same code over and over. It keeps the code clean, and easy to debug later. If you want to change anything for the footer, for example, if you rewrite the code over and over it will be quite tedious to change the code of each and every code. On the other hand, if you have them as separate files, this would be done by simply editing a single code. Including separate files is much more efficient than rewriting the same code.
Upvotes: 1