NOTEPAD++ TEXT STAYS THE SAME WHEN VIEWED IN BROWSER
Newbie104 last edited by
I just recently started learning how to write in html and css so for the starters I decided to write a simple code and planned to expand from it as I learned. As you see I wrote simple text with not much place for error and wanted to view how does it look in a browser before writing anything serious. Alas viewing or even running the code on any browser didn’t seem to do much, and the text stayed looking the same as it did when writing it on notepad++. I’ve checked the code on https://codepen.io and the visualization of code was proper on there so the problem must be with the notepad it self I guess? Any advice?? I’m using Windows 10, 64-bit.
Terry R last edited by
@Newbie104 said in NOTEPAD++ TEXT STAYS THE SAME WHEN VIEWED IN BROWSER:
so the problem must be with the notepad
No, the problem is you saved it as a
txtfile. HTML file is text but with a different extension, generally
html. Notepad did exactly what you asked of, so no fault there.
Alan Kilborn last edited by
Here’s what I see for what went wrong for OP.
OP started writing his file in a
new 2(example) tab in Notepad++.
At some point OP saved his file (e.g. Ctrl+s) and was prompted to save as
new 2.txt. That entire filename was highlighted. OP didn’t want that name so OP overtyped with
experimentasand pressed the Save button. Note that no extension was specified and the Save as type box said
Normal text file (*.txt).
Notepad++ correctly saved the file as
experimentas.txt. OP didn’t notice the
.txtor didn’t know he should care about that (new to Windows?/computers?).
At some point after this, OP set the Language of the file, probably to HTML. Otherwise, we wouldn’t see the syntax highlighting shown in the screenshot.
OP then requested the file be shown in a browser. As Terry indicates, the browser correct displays the file as text, because of the
.txtextension on the file.
Correct OP behavior would have been either to (a) set the Language before saving (in which case Save as type would have been displayed as “Hyper Text Markup Language”, and the extensionless file specified would have gotten
.htmladded automatically) or (b) specify
experimentas.htmldirectly for the File name.
Note: The above would be a bit different if the OP had Set Save dialog extension filter to .* instead of .txt for Normal Text ticked in the Preferences, but that is not the default setting.
Newbie104 last edited by
Thank you for insight guys! I guess I’ll be paying attention to what type of file I am saving Ha ha ha. Cheers!