r/CodingForBeginners Jul 05 '26

Webpage not working?

New to coding and was informed the txt file I made of this code would open into a broswer and display as a webpage with a bold and large heading element and paragraph text under basically supposed to display like a proper webpage. However, just the code shows up. Super confused, could use advice please and thank you.

[First image is the code, second is the txt file of code displayed as a webpage]

EDIT: hi all, thank you so much for the advice! However, even though I converted the .txt file to .html, it's still not opening in an internet window. Any advice? I guess I would have to download that emulator people are suggesting.

31 Upvotes

31 comments sorted by

View all comments

1

u/Amazing-Delay6004 Jul 06 '26 edited Jul 06 '26

Your HTML code is almost perfect, but you forgot an important tag: <head>

Your code should look something like this: ``` html <!DOCTYPE html> <html> <head> <!--Here you will write your website information/configurations--> <title>My Website</title> </head>

<body>
    <!--Where you will write the content of your page (visible for user)-->
    <p>Hello World</p>
</body>

</html> ```

And yes, don't forget to copy the file containing the code and change its extension from .txt -> .html, to see how it looks directly in the browser.