Having Trouble With HTML Layout Breaking on My Restaurant Website

Hi everyone, I’m working on a restaurant-focused website (mainly publishing menu updates, food reviews, and guides), and I’m running into a strange HTML issue that I can’t figure out. I recently updated a few of my pages, and ever since then, some parts of the layout behave unpredictably across different browsers. The same HTML structure looks fine in Chrome, but Firefox and Brave break the layout completely.

The issue seems to be related to a section where I’m using nested <div> elements inside a flex container. Even though the code validates, certain items either overflow or collapse entirely. I double-checked my CSS, but even with all styles removed, the raw HTML still renders differently in some browsers. That makes me think something about my markup is off.

One specific problem is with a block that contains menu descriptions wrapped in <p> tags. In Firefox, the paragraphs ignore my spacing and bunch up tightly. In Chrome they display normally. I tried adding <br> and adjusting the hierarchy, but nothing changed. I also inspected the computed styles and saw no overrides coming from CSS or JavaScript.

Another weird thing is that when I include an HTML comment inside this section, like <!-- test -->, the entire layout shifts. Removing the comment fixes it. I’ve never seen a simple HTML comment break structure before, so I wonder if there’s a nesting or closing-tag issue I’m not noticing. I ran the markup through several validators, and they don’t report anything major.

I’m also noticing that my <header> and <main> tags sometimes appear inside each other when inspecting the DOM, even though the source code is correct. This made me suspect there might be an unclosed tag somewhere earlier on the page, but I haven’t found it yet. The strangest part is that the problem doesn’t occur consistently it only happens when the menu dataset loads dynamically.

Has anyone experienced inconsistent rendering across browsers due to subtle HTML structure issues? I’d appreciate any tips on how to debug hidden nesting problems or identify markup that browsers interpret differently. Thanks in advance!

Hi there and welcome back to the forum!
Thanks for detailed description but to help we need to see your code.
Is your website live? If not please share Codepen or something