Same basic HTML loads properly in Firefox, but in Chrome and Brave the entire html document is <body>?

I opened a simple html document in a code editor to play around with things as I worked through the exercises, but ran into an issue with opening the html in a browser to view it. In several browsers, the entire html document I had written was displayed in the browser. When I looked in developer tools, the browser had interpreted all of it (from the opening doctype to closing html tag as being body. Firefox correctly interpreted it. Why?

Hi @liv-lilit and welcome to the community :wave:

That sounds mysterious :sweat_smile: Does the file have the correct extension (.html or .htm)? Your operating system may hide the true extension. So it could be “test.html.txt”, but looks like “test.html”. How did you create the file? How did you open it in the browser? Do you have to the possibility to upload the file somewhere and post a link to it?

I think the forum removed part of your post because of HTML tags. Could you please use backticks (`) around your code or use backtick fences on the lines above and below your code like this:

Your code

I hope we can solve this problem :blush:


Hi Michael!
I created the code in vscode and declared the file type to be html and saved it from there. I opened it in the browsers using the local filepath. I feel like it isn’t the code, because I have been working through the web development modules using this workflow for a while, and this is the first time this has happened. (Previous documents I had created open fine, but I have attempted to create several new ones and they all have this problem).

<html lang="en" dir="ltr">
    <meta charset="UTF-8">

Nevermind- you solved it! For some reason, that didn’t save it as .html and renaming it fixed the problem. I don’t know why the file type wasn’t correct, but now I know! Thank you


You’re welcome!
I hope you have fun with the exercises. If you ever like to have a task assessed, feel free to post again. We are glad to help you. :slightly_smiling_face:


1 Like