Courses
Help
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
- Open a text editor (e.g., Notepad).
- 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>
-
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
- Open the folder where you saved the file.
- Double-click the file → It will automatically open in your default browser.
- Or, right-click the file → Choose Open with → Browser name.
- 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.