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 .txt
to .html
.
There are two ways to open a file saved with the .html
extension for viewing in the browser:
Windows
- 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
Windows:
- In the open editor (or in a text document), click
file
→ choosesave as
→ below in the text boxfile name:
write for example:mypage.html
→ clicksave
. That's it, HTML document created. - Right-click on the text file → choose
rename
and change the extension from.txt
to.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: openControl Panel
→ chooseFolders settings
(in Windows 10, this item is calledExplorer Options
) →view
tab → scroll to the bottom and remove the checkmarkhide extensions for registered file types
.
With this theme look: