How to reuse a navigation bar?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

27th Apr 2021, 7:25 PM
Ahsan Tony
Ahsan Tony - avatar
4 Answers
+ 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.
27th Apr 2021, 7:32 PM
A͢J
A͢J - avatar
+ 1
How?
27th Apr 2021, 7:29 PM
Ahsan Tony
Ahsan Tony - avatar
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.
27th Apr 2021, 7:28 PM
A͢J
A͢J - avatar
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.
27th Apr 2021, 7:48 PM
inxanedev!
inxanedev! - avatar