Creating an HTML document
An HTML document is a plain text file with an extension
.html that contains HTML code. HTML document is otherwise called HTML file.
To make an HTML document from a plain text file (with extension
.txt), you need to change the extension from
There are two ways to open a file saved with the
.html extension for viewing in the browser:
- Click on it twice with the left mouse button, in this case the HTML document will open in the browser that is selected by default.
- Click on it with the right mouse button → move the cursor to
open with...→ Select the browser.
When the HTML document is received, the browser will display it as a web page (web page is what's displayed in a browser window). Let's take an example. Create an HTML document and place the following HTML code in it:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Header</title> </head> <body> <h1>My first headline</h1> <p>My first paragraph</p> </body> </html>
Now open the HTML file with the browser. In the browser window, we will not see the HTML code itself, because it will be interpreted to display the contents of the page as it should. The result of this code in the browser window:
To edit the HTML code of the document, сlick on it with the right mouse button → move the cursor to
open with... → and select the desired editor, if the list does not have the correct editor, press
Select a program... and select the desired editor. Some editors (for example, take notepad++) can be selected directly from the context menu, by right-clicking on the document and selecting from the top
Edit with Notepad++.
How to change a file extension
- In the open editor (or in a text document), click
save as→ below in the text box
file name:write for example:
save. That's it, HTML document created.
- Right-click on the text file → choose
renameand change the extension from
.html. To use this method, we need to make sure that all files have their extensions available by default, this is done in the following way: open
Control Panel→ choose
Folders settings(in Windows 10, this item is called
Explorer Options) →
viewtab → scroll to the bottom and remove the checkmark
hide extensions for registered file types.