DEV Community

How to render common webpage elements to all pages?

Shubham Kumar on March 18, 2019

How to render common web page elements such as NAVBAR, FOOTER, to every page when I am just using HTML, CSS & JS?
I will be not following the DRY principal if I just copy paste elements to every page.
Any ideas?

Collapse
 
berniwittmann profile image
Bernhard Wittmann

Another possibility would be the use of WebComponents. With that you can define your own custom html elements, which then get rendered. Check out this quick tutorial about usage of custom elements on MDN

Collapse
 
lingam247 profile image
Daniel Selinger

You can take a look at en.wikipedia.org/wiki/Server_Side_...