1
How do I not repeat the HTML and CSS code of a site’s structure? For example, I did the structure of a web page and I want that structure to be applied to the other 5 pages that I will create for that site. Follow the page print:
For this I created an HTML file and a CSS. To replicate this structure to the other pages I created HTML and CSS files for each of the other 5 pages I copied and pasted the codes of this structure into them. But this is very repetitive, I think there’s a more efficient way to do this. If I change anything in this sidebar, I took that change in the other 5 files, for example.
Is there any method to avoid this repetition?
I think only with PHP, or copy Paste.
– Leon Freire
You can use JS for this, take a look at the jQuery load
– Rafael Augusto
@Rafaelaugusto The problem of
.load()
jQuery only works online.– Sam
For me the best solution is to copy the file and paste inside the folder with another name. It is worth remembering that all the links related to css, js, images... Shall be valid
– Renato Junior
Study more about includes in PHP, it does exactly what you want. Generating an equal html for all elements being changed in only one file.
– user86267