You’re not going to be able to do this in straight html/css. You’ll probably want to do it using js.
But I just want to point out that the list is not valid html. The a element needs to be inside the li elements. I’d move the link inside the h1 element, but technically that’s valid
I only have an index.html page with content that I would simply like to be able to translate into French and English via two flags in the navigation bar.
I looked on the web it shows examples with json.
How can I do it as simply as possible in my case which is only a simple portfolio?
Realistically for just one page like that, it would probably be easier for you to just make a duplicate second page in the other language. You could have index-en.html and index-fr.html, and then in the nav bar you could link the two pages to each other via a picture of the flag or something.
No technology to worry about, just translate the text.
** actually you probably want one of the files to be still named index.html so that folks end up on some file if they don’t know to add -en or -fr to the link.
You didn’t fix the list as @DaveMaxwell already mentioned as the structure is broken and unworkable like that.
If you use the correct list structure you can use nested uls for the dropdown like this:
Of course touch devices will have a few problems with that as they don’t really have a hover effect. You will need to restyle the menu and behaviour for small screens as required.
A more accessible method would be to swap the hover effect for some JS and make a click dropdown instead of a hover dropdown.