logo

Writing HTML Documents

An HTML document is simply a text file that contains HTML code (tags + content). It always has a .html or .htm file extension.


1. Editors for Writing HTML Documents

Since HTML is just text, you can write it in any text editor.

  • Basic Editors:

    • Notepad (Windows)
    • TextEdit (Mac, in plain text mode)
  • Advanced Editors (recommended):

    • Notepad++
    • Sublime Text
    • Visual Studio Code
    • Atom

👉 These advanced editors give you features like syntax highlighting, auto-completion, and easier debugging.


2. Browsers for Viewing HTML Documents

  • A web browser is used to open and view HTML files.
  • Examples: Google Chrome, Mozilla Firefox, Microsoft Edge, Safari, Opera.
  • The browser interprets HTML code and displays it as a web page.

👉 Remember:

  • Editor = Writing tool
  • Browser = Viewing tool

3. Steps to Create an HTML Document

  1. Open a text editor (e.g., Notepad).
  2. Type HTML code. Example:
<!DOCTYPE html>
<html>
  <head>
    <title>My First Web Page</title>
  </head>
  <body>
    <h1>Hello, World!</h1>
    <p>This is my first HTML document.</p>
  </body>
</html>
  1. Save the file:

    • Go to File → Save As
    • Choose a location (like Desktop or Documents).
    • Type the name with .html extension, e.g., index.html
    • In “Save as type” choose All Files (important in Notepad).
    • Click Save.

4. Steps to View an HTML Document

  1. Open the folder where you saved the file.
  2. Double-click the file → It will automatically open in your default browser.
  3. Or, right-click the file → Choose Open with → Browser name.
  4. The browser will render the HTML code into a proper web page.

Quick Points to Remember (for exams):

  • HTML files are created in a text editor and saved with .html/.htm extension.
  • To view them, use a web browser.
  • Editors write the code, browsers interpret and display it.