In the previous blog post, we have learned what is HTML and in this blog post, we will learn how to create a simple HTML page from scratch.
To get started, just create a new folder and name it “my-website” and inside that folder create a new Text Document (.txt) file and save it as index.html and add the following code to it.
The above code is a very basic and standard code that basically adds necessary HTML tags for a web page.
- <!DOCTYPE html>: tells the browser that the document type of this file is HTML
- <html></html>: The <html> tag tells the browser that contents added in between these tags are HTML tags
- <head></head>: The <head> tag is used to define meta data for the web page. The contents inside the head tag are not displayed on the website
- <title></title>: The <title> tag defines the title of the web page which is shown in the browser tab
- <body></body>: The <body> tag actually define the contents of the web page visible inside the browser
- <h1></h1>: The heading tag (<h1>-<h6>) is used to add different level headings in the web page
- <p></p>: The paragraph tag (<p>) is used to add paragraph in the web page
Now save this document and open it inside the browser e.g. Google Chrome and you will see the following output:
Welcome to my web page.
Congratulations! You have just created your first web page using HTML. In the next tutorials, we will learn about the other HTML tags and how to use them. Stay tuned!
If you have any questions, please feel free to ask in the comments section.