An HTML file is simply a text file saved with an .html or .htm extension.
Creating Your First HTML Document
Web pages created using HTML files. An HTML file is simply a text file saved with an .html or .htm extension. So we need a software to create HTML file. This software or program that used to create HTML files is called a ‘text editor’ . A text editor is a program that we use to create html files and ‘run’ or ‘ execute ‘ our HTML code. Now when you save and run your html code. Your computer automatically opens it in a web browser like Google, Firefox, Safari etc.
Write HTML Using Notepad or TextEdit
There are many Text Editors. However, for learning HTML we recommend a simple text editor like Notepad (on Windows ) or TextEdit ( on Mac ).
So let’s finally start.
Step 1: Open Notepad (on Windows/ PC)
Open The Start menu ( the window symbol at the bottom left on your screen ) Type Notepad
Open this Notepad
Step 2: Write Some HTML code
Write or copy some HTML into Notepad. You can copy the code below.
<!DOCTYPE html> <html> <head></head> <body> <p>Hello World</p> </body> </html>
Step 3: Save the HTML file
Save the file on your computer . When you copy and paste this HTML code into Notepad.
İn the Notepad menu ( On top left ) select: -> File -> Save ->
When you click on ‘ Save ‘ a box occurs
At the bottom you will see
- File name
- Save as type
Name your file as ( index.html )
Save file as : All files (*.*)
Note: It is important that the extension
.html is specified — some text editors, such as Notepad, will automatically save it as
Step 4: View the HTML Page in Your Browser
To open the file in a browser. Navigate to your file then double click on it. It will open in your default Web browser. If it does not, open your browser and drag the file to it.
Good to know
When you name your html files remember these:
1) You have only 1 home page and you should name the HTML file for your home page ( index.html or index.htm )
2) For other pages such as ‘About ‘ , ‘ Contact’, ‘Projects ‘ etc..
You can name them anything you want. There is no rule for that. But give them meaningful names and easy to remember for yourself. Still the end of file name should be ( .html or .htm)
For instance: about.html or contact.html
3) Always use lowercase for naming files