Basic Structure

Learn the basic structure of an HTML document, including the Doctype declaration, HTML tags, and the essential HEAD and BODY elements for building web pages.

Loading...
Basic Structure
  • HTML version information: The Doctype declaration is used to identify the version of HTML used by the webpage. It must be specified at the beginning of every document in the following manner:
<!DOCTYPE html>
  • The <html> element: The html element consists of starting and end tag. It contains all the information and content of the web page.
<html> </html>
  • The <head> element: The head element consists of the information about the HTML document, i.e. title of the page, character set, version of HTML, styles, scripts, and other meta information.
<head>
 <meta charset="UTF-8" />
 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 <title>Title</title>
</head>
  • The <body> element: The body element consists of everything that you want to display on the Web Page.
<body></body>

Here’s the full basic structure of an HTML document:

<!-- Defines version of HTML -->
<!DOCTYPE html>
<!-- Defines language of HTML -->
<html lang="en">
<!-- Details about the web page -->
 <head>
  <!-- Defines the character encoding of HTML page -->
  <meta charset="UTF-8" />
  <!-- Defines the compatibility of version with browser -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <!-- For making the website responsive -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <!-- Title of the web page -->
  <title>HTML</title>
 </head>
 <!-- Everything you want to display on the web page goes into the body part -->
 <body>
  <!-- Main content for web page -->
 </body>
</html>

👉 Next tutorial: HTML Comments

Support my work!