To create a web page in HTML first you should know what is a web page?
Softwares required for creating a web page
- A plain text editor e.g Notepad, Notepad++, VsCode(IDE) etc.
- A web browser e.g Google Chrome, Firefox, Opera, Internet Explorer or Safari
Don't use a word processor(e.g Microsoft Word) as your text editor for creating a web page, we need an only plain text editor(mentioned in point number one).
Once we have above both software, we are good to go.
Step 1: Open up your plain text editor
I am using Notepad just for simplicity, you can use Notepad++, VsCode or any plain text editor of your choice.
Step 2: Writing code for the web page
For creating a web page HTML is used, HTML stands for HyperText Markup Language.
Wikipedia defines HTML as
Hypertext Markup Language is the standard markup language for documents designed to be displayed in a web browser.
Now writing HTML code for our simple and basic web page.
<html> <head> <title>Title of the web page</title> </head> <body> <h1>This is a heading in the web page :)</h1> </body> </html>
Copy the above HTML code and paste it in your plain text editor.
Explanation of the above HTML code
Content of any web page goes between
</html> HTML tags. Every web page has two sections:
- Head(content between
- Body(content between
Body section generally consists of web page Header, Main body, Footer, Sidebar, etc. in our case it consists of h1 tag containing some text.
Step 3: Saving the HTML code
Basic HTML code for our web page is ready, now to create our web page we need to save this HTML code on our computer and for that follow below steps:
- In your text editor click on the File option(at top-left corner) then from dropdown click on Save, you will see a window like this(on Windows)
- From the left panel of the opened window navigate to the folder where you want to save the HTML code(I will be saving it in the Documents folder).
- Now type the name which you want to give to your file in the File name input box. Here we can name our file to my_web_page.html, my-web-page.html, web_page.html, etc. You should name your file based on its content e.g if the web page contains the about data then name it about.html, if it shows user profile then name it profile.html and so on. Use a combination of alphabets, numbers, underscore and hyphen for your file name, you can use other characters also but some characters like *, ?, " are not allowed in the file name in computers using Windows operating system and similarly, / is not allowed in the file name in Linux based systems. You can use .html and .htm as file extension for your HTML files both of them are valid but you should use .html extension, .htm was in use very long time ago because at that time using four-letter extension(e.g .html) was not supported in many operating systems but now this is not a problem anymore so we can use four-letter extension.
- After you have typed the file name(e.g my_web_page.html) then click on the Save button now you can close your text editor if you want.
Step 4: Opening the web page
Navigate to the folder where you saved the HTML file, right-click on the file(web page) and open it using any web browser.
This is how your web page will look like in the web browser(Google Chrome).
The text written between
</title> tags is displayed on the browser tab(refer to above image).
Share this article with others.