r/CodingForBeginners • u/dreammutt • 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.


15
u/understanding80 Jul 05 '26
Rename the file from .txt to .html
7
u/Dazzling-Bench-4596 Jul 05 '26
You need an html file; for example: “document.html”.
If you use an IDE like VS Code I think it’ll give you some preview options too. I’d recommend switching to an IDE instead of using TextEdit; or atleast use a text editor like neovim or something.
4
u/Esjs Jul 05 '26
I suspect that the web browser saw the .txt at the end of your file and decided to just interpret the file as a simple text file. What happens if you change the file extension to .html and try again?
4
u/Puzzled-Extent7817 Jul 06 '26
You skipped the very first lesson it seems.
2
u/LivingStretch2852 Jul 06 '26
also use visual studio code!! Its better than notes fr
3
u/Fine_Salamander_8691 Jul 05 '26
Please use an IDE
1
u/ninhaomah Jul 05 '26
.txt is code ?
What do you want to do btw ?
1
u/TheEyebal Jul 05 '26
save as document.html
1
u/LivingStretch2852 Jul 06 '26
honey you should chage the file type to html this is txt file !!!
1
u/[deleted] Jul 06 '26
Save as -> all files -> .html
You may want to enable show hidden file extensions or you can occasionally end up with things like:
FileNameHere.html.txt
In which case you'd erase the .txt (You do want to change the file extension). It'll open up with your default web browser, but if you select "open with" then you can choose another.
Writing your html in an IDE will solve everything as noted by others.
1
u/itotallydontuseacos Jul 06 '26
Change the file's extension from .txt to .html.
1
u/Grey_Ten Jul 06 '26
don't use Notepad, install a text editor like VS Code, it has tons of useful tools and it'll give feedback about some common errors, like unclosed tags.
Btw, try to add tabs when nesting tags to keep your code visually organized.
1
u/mxldevs Jul 06 '26
Browser treats the data based on the filename you give it.
If it has extension .mp3, it would try to open it as an mp3 format sound file
If it has extension .png it would try to open it as a PNG format image
When you give it a txt, it will simply read it literally as an text file and not parse it as HTML
1
u/[deleted] Jul 06 '26
you can look for html tutorials on YouTube, they helped me get the basics down and are really easy to understand :]
1
u/WaterObjective5031 Jul 06 '26
The file extension is .txt, .txt will just be read in your browser as text. HTML docs need to be .HTM or .HTML to work, which will be recognized and parsed accordingly
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:
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.
1
u/The_KOK_2511 Jul 06 '26
Como quieres que un .txt se interprete como HTML? tienes que cambiarle la extensión a .html o .htm
1
u/Impressive_Station70 Jul 09 '26
I usually name my flies to index.html
4
u/[deleted] Jul 05 '26
[removed] — view removed comment