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
That sounds mysterious 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
Michael
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>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
</head>
<body>
<h1>PLEASE DOES THIS WORK</h1>
</body>
</html>
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.
Michael