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/solved-by-flexbox/
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.