How to create an HTML Document?


HTML stands for Hyper Text Markup Language. It is the most widely used language to write web page. HTML document defines the structure of web page.

HTML document begins with the <!DOCTYPE html> declaration, and the HTML documents start and end with the <html> and </html> tags.

HTML document is split into two parts −

  • Head

  • Body

The head which contains the information about the document title etc. The information inside this tag does not display outside (on web page). The information of the head part is placed between <head>…</head> tags.

Example

Following is the example program for the head tag.

<!DOCTYPE html> <html> <head> <title>HTML Articles-This is a title of the page </title> </head> <body> </body> </html>

Following is the output for the head tag and the information inside the head tag does not display on the web page.

The information inside the head tag gets displayed in the title bar of the browser.

The body contains the content of the document, which gets displayed on your screen. The information of the body is placed in between <body>…</body> tags.

Example

Following is the example program for the body tag.

<!DOCTYPE html> <html> <body> <p>The paragraph which are need to display on the web page are to be placed in between the paragraph tags.</p> </body> </html>

On executing the above HTML code, the information inside the body tag gets displayed on the browser.

Creating a complete document with head and body tag.

Follow the steps to create HTML document.

  • Open a text editor Notepad++.

  • Write your HTML code into Notepad++.

  • Save the file with .html extension.

  • Run the file.

Example

Below is the structure of the HTML page.

<!DOCTYPE html> <html> <head> <title>HTML Articles</title> </head> <body> <p>The paragraph which are need to display on the web page are to be placed in between the paragraph tags.</p> </body> </html>

On executing the above program, the information about the head tags gets displayed on the title bar and, the information inside the body tag displayed on the browser.

Updated on: 11-Nov-2022

16K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements