+ 1
How to reuse a navigation bar??
I want to make a multipage website with a top navigation bar do i need to copy-past the navigation bar code into all my pages or i can use only writting it once if it's possible then how please someone help me
4 Respostas
+ 2
Ahsan Tony
If you are using php then there is option to include files.
If you are using pure html then there is option to load any file in html using load() function of jQuery.
3rd option write JS code for navigation bar and append in body tag.
+ 1
How?
0
Ahsan Tony
No need to do copy paste. Just make a file, write your navigation bar code and include that file in every page.
0
Alternatively, use a UI framework like React or Svelte. They have a concept of "components", which are reusable bundles of HTML, CSS, and JavaScript.
I highly recommend Svelte as a first-time framework because it's so easy to learn.