What Is The Basic Structure Of HTML Document: Guide To Beginners.

  • Post category:HTML
  • Post author:
  • Post last modified:May 9, 2022
  • Reading time:4 mins read
You are currently viewing What Is The Basic Structure Of HTML Document: Guide To Beginners.

An HTML document’s basic structure is divided into two major parts. One is the head and another body. HTML starts with a document type declaration. Then root element of the document <html> start. After the root element head section of the document start with the <head> tag and is closed with the </head> tag. And then <body> tag starts and closed by the </body> tag, at last the root element closed with the </html> tag.

The head section of an HTML document contains meta information, page title, internal style sheet, JavaScript files, and other important resources links. which are invisible in the document from a user side. Although page titles are shown on the browsers tab section.

The body tag contains the visible area of an HTML document from a user side. It contains headings, paragraphs, lists, images, etc.

HTML Basic Structure

Here is the HTML basic code structure which is present in almost all HTML documents.

<!doctype html>
<html>
<head>
<title>page title</title>
<style>
body{
  background-color:orange;
}
</style>
</head>
<body>
<h1>Heading 1</h1>
<p>Some text...</p>
<div>
<p>Some text...</p>
<img src="mango.png">
</div>
</body>
</html>

HTML Basic Code Explanation

Here is the explanation of basic HTML code.

<!doctype html>

The <!DOCTYPE html> is declaration of the document type. It shows that it is an HTML document. This is mandatory for HTML documents, it helps the browsers to display the document correctly.

<html> ... </html>

This element is the root element of an HTML document. All the tags will be written under this root tag.

<head> ... </head>

The element is another important part of an HTML document. It does not contain the visible part of the HTML document from the user side, but it contains all the major information of a document.

<title>page title</title>

The title element contains the document title. Which is shown in the browsers tab section. This title appears in the search engine results.

<style> ... </style>

The style element contains the internal CSS of your document.

<body> ... </body>

The element contains all the visible parts of web documents from a user side. It is the main element that contains all the elements that complete a web page.

Ashim Khatua

Professionally Web Developer since 2015, And also a Blogger. I am the founder of SiteCodings.com. I love to share my knowledge, which I earned the past few years. I want to share my knowledge with you through my Blog. Keep Reading.

Leave a Reply