How I can make Header of my page that shows on every page on my website? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

How I can make Header of my page that shows on every page on my website?

Which mathord is best for defining a web header that contain on all my website page. I mean I want show my web logo on every web page. How I can?

13th Nov 2017, 7:22 PM
Shahid ali
Shahid ali - avatar
4 Respuestas
+ 5
You could just include the header file with something like PHP. You could also create a wrapper system where you start the beginning portion of your website in the header, the body/main portion of it in each of the individual page files, and then end the wrapper/everything else in the footer of the page. This allows you to easily create a header/footer that transitions between pages for you.
13th Nov 2017, 7:26 PM
AgentSmith
+ 5
Using JS for that purpose is a bad idea as many people have JS blockers on their browsers to prevent unwanted scripts from taking place. If you go with the JS method, your site won't be optimal for the people (which is a lot of people) doing such things. The core, basic features of a website (such as its header/body/footer/etc..) should accommodate as many people as possible, and should take into consideration JS being disabled. However, that isn't to say your method won't work, so thanks for adding in another way of going about it. The more ways you know how to do something the better prepared you are for whatever your situation is.
13th Nov 2017, 8:06 PM
AgentSmith
+ 3
I'm guessing putting the header in one file that gets loaded by each of the other pages. However, I'd love to hear the answer to this question.
13th Nov 2017, 7:28 PM
John Wells
John Wells - avatar
+ 3
define the structure in main.js and define the style main-style.css in every page use <script src="main.js"></script> and <link rel="stylesheet" href="main-style.css" type="text/CSS"> or use only JS FILE contain of structure and style
13th Nov 2017, 7:53 PM
Mukhtaar Aziz
Mukhtaar Aziz - avatar