put it in a iframe or rewrite it in something that supports templates. html is for static content not those where the content might change like that.
Anyone a real pro with html, css?
What you want is a website that via PHP or whatever includes a .html header and footer file in each of your pages.
Look at web 1.0 CMSs like Webspell (lol).
Or blohg, blohg.readthedocs.io
I'm glad you took my advice, that's precisely the thing flexbox was created for. I remember when I first learned about flexbox my jaw dropped and I was like "wait, we can do all these things in pure CSS without any hacks!?". This is where I first learned about flexbox.
philipwalton.github.io
Not in HTML, it is pure content without any logic. HTML (and XML) is not really meant to be written by hand (even though you can do it), it is meant to be generated. There are three solutions: one very bad, one that you should only use when you need it, and one that's actually good but not suitable for all cases.
< The bad solution (client-side generation)
Use Javascript to generate the header. This is bad because it requires users to run interactive code for something that is not supposed to be interactive. People who don't have Javascript or have it turned off will not be able to use our website. Javascript should only be used when necessary (e.g. when making an interactive web app) or as optional eye candy (and even then you should ask yourself whether it really is a good idea). I'm including this option for the sake of completeness.
< Server-side generation
When you use a search engine the designers cannot know every possible search query, so the page has to be generated unique to each request. This means that the user sends a request like "search for dragon-dildo", the web server runs some code to query a database on its end, uses the result to generate HTML on the fly, and finally sends the generated HTML back to the users. This requires you to have access to a web server (not something that cheap hosting solutions provide), it puts extra work on the server and it opens up an attack vector because now your server is executing code sent in by the user.
Server-side generation is not a bad solution, but in your case it causes more problems than it solves. I would avoid it unless there was not other way (like when implementing a search engine).
< Static site generation
Static site generation takes the idea of server-side generation, but runs in only once. You have a program, the generator, which generates the HTML for you once, then you upload the files to the server and the server only serves the static content. This is what I do, I can generate the files on my home computer without needing control over the web server.
When using a static site generator you don't write your entire HTML file, you write a template with placeholders which the generator will then fill in. So in the case of a header you would leave a placeholder in every page and then the generator would fill in all the pages. Most generators can also do entire blogs instead of just individual pages.
Common generators are Jekyll, Hugo or Pelican.
jekyllrb.com
gohugo.io
blog.getpelican.com
I cannot tell you which one is best because I have written my own in Scheme using GNU Guile. Writing your own static site generator is a bit of a ritual of passage in Lisp communities.
You can use Geany's "search and replace in session" feature.
Server-side includes are what you want. They let you modularize parts of your pages like headers and footers without needing Javascript.
en.wikipedia.org
It's always been really perplexing to me how little it seems people use this.
PHP and the extra overhead that comes with it is completely unnecessary, Apache and nginx both support server-side includes.
Aren't they discouraged due to "using too much CPU" or some bullshit?
Are they? I find that hard to believe when you would otherwise need an additional process running to interpret PHP or whatever other language you want to run server-side just for the purpose of piecing together elements to construct a whole HTML on client request. Why would that be more efficient than something already built into the server process?
I dunno. I'm not claiming it's true, I just remember reading several things to that effect when I first learned about them.
server side includes
or use PHP with template
both are different ways of doing:
pageX.html
#INSERT header.html HERE
page content
header.html
content to include in pages