How to save a HTML document 

 

  1. Go to File > Save As.
  2. File Name: Give it a name and manually add the .html extension (e.g., index.html or myfirstpage.html).
  3. Save as type: Crucially, change this dropdown to “All Files” (or similar) to prevent the computer from automatically adding a .txt extension.
  4. Encoding: Select UTF-8, which is the recommended encoding for HTML5.
  5. Click Save.

Steps in Detail

  • Open a text editor such as Notepad.
  • Type the HTML code.
  • Click File > Save As.
  • Choose the folder where you want to save the file.
  • Type the file name with the extension .html or .htm, for example index.html.
  • In Save as type, select All Files (*.*) so Notepad does not add .txt at the end.
  • Set Encoding to UTF-8 and click Save.

Viewing the Web Page

Go to the folder and double-click the file. It opens in the default web browser. You can also right-click the file and choose Open with to pick a browser.

Editing and Refreshing

To make changes, right-click the file and open it with Notepad, edit the code, save it again (Ctrl + S), and press F5 in the browser to reload the page.

Common Mistakes

  • Saving as page.html.txt because “All Files” was not selected.
  • Leaving spaces or special characters in the file name.
  • Forgetting to save before refreshing the browser.

Important Questions

Q. What extensions are used to save an HTML file?
Ans. .html or .htm

Q. Why should we select “All Files” while saving in Notepad?
Ans. Otherwise Notepad adds a .txt extension and the file opens as plain text instead of a web page.

Q. Which key is used to refresh a web page in a browser?
Ans. F5