The Wayback Machine - https://web.archive.org/web/20240710214407/https://www.geeksforgeeks.org/html-course-structure-of-an-html-document/
Open In App

HTML Course Structure of an HTML Document

Last Updated : 03 Jun, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

HTML(Hypertext Markup Language), structures web pages. Unlike programming languages, it isn’t compiled or interpreted. Browsers render HTML directly, displaying content without typical errors. It’s a markup language, not a programming one, making execution smooth without encountering compilation or interpretation issues.

Html-Document-(1)

Structure of an HTML Document

HTML Document Structure

HTML uses predefined tags and attributes to instruct the browser on how to display content, including formatting, style, font size, and images. HTML is a case-insensitive language, meaning there is no distinction between uppercase and lowercase letters.

There are generally two types of tags in HTML: 

  1. Paired Tags: These tags come in pairs i.e. they have both opening(< >) and closing(</ >) tags.
  2. Empty Tags: These tags are self-closing and do not require a closing tag.”

Below is an example of a <b> tag in HTML, which tells the browser to bold the text inside it. 

Tags and attributes

HTML tags are structural components enclosed in angle brackets. They are typically opened and closed with a forward slash (e.g., <h1></h1>). Some tags are self-closing, while others support attributes like width, height, and controls for defining properties or storing metadata.

Structure of an HTML Document

An HTML Document is mainly divided into two parts: 

  • HEAD: This contains the information about the HTML document including the Title of the page, version of HTML, Meta Data, etc.
  • BODY: This contains everything you want to display on the Web Page.

HTML Document Structure


Example: To demonstrate basic HTML document structure.

HTML
<!DOCTYPE html>
<!-- Defines types of documents : Html 5.O  -->
<!DOCTYPE html>
<!-- Defines types of documents : Html 5.O -->
<html lang="en">
<!-- DEfines languages of content : English -->

<head>
      <!-- Information about website and creator -->
      <meta charset="UTF-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <!-- Defines the compatibility of version with browser -->
      <meta name="viewport" content="width=device-width, 
                   initial-scale=1.0" />
      <!-- for make website responsive -->
      <meta name="author" content="Mr.X" />
      <meta name="Linkedin profile" content="WWW.linkedin.com/Mr.X_123" />
      <!-- To give information about author or owner -->
      <meta name="description " content="A better place to learn computer science" />
      <!-- to explain about website in few words -->
      <title>GeeksforGeeks</title>
      <!-- Name of website or content to display -->
</head>

<body>
      <!-- Main content of website -->
      <h1>GeeksforGeeks</h1>
      <p>A computer science portal for geeks</p>
</body>

</html>

Understanding Essential HTML Tags

  • DOCTYPE Declaration (`<!DOCTYPE HTML>`): It specifies the HTML version; typically indicates HTML5.
  • <html>: The root element that encompasses the entire HTML document structure. It serves as the parent to both the <head> and <body> tags.
  • lang attribute: Specifies the language using the “lang” attribute (e.g., lang=”en” for English
  • <head>:Container for metadata, title, CSS, scripts, etc.
  • Content: While not directly displayed, it serves informational and structural purposes.
  • <body>: A body tag is used to enclose all the data which a web page has from texts to links. All the content that you see rendered in the browser is contained within this element. 

Previous Article
Next Article

Similar Reads

How to fix “No character encoding declared at document level” in HTML Document ?
This article intends to solve the “No character encoding declared at document level” issue in your HTML program. So, before getting to the solution, we need to understand what this issue means. And for that first, we need to know about character encoding in HTML. What is character encoding in HTML? Character encoding is a system used to represent c
5 min read
HTML Course Understanding and Building Project Structure
Course Navigation We have created all of the directories needed for our project. Let's just start writing our HTML code. Since we are designing a single page website - Website with a single HTML page( No internal links ). So, we will write all of our codes in the file "index.html". We donot need any other HTML to create for this project. Before we
3 min read
How to check the structure of an XML Document ?
Introduction : XML document is a well-organized collection of components and associated markup. An XML document can hold a wide range of information. For instance, a database having numbers or a mathematical equation etc. Example: A simple document can be created as - &lt;?xml version = "1.0"?&gt; &lt;Student-info&gt; &lt;name&gt;Tanya Bajaj&lt;/na
3 min read
How to define structure of XML document ?
An XML (EXtensible Markup Language) Document contains declarations, elements, text, and attributes. It is made up of entities (storing units) and It tells us the structure of the data it refers to. It is used to provide a standard format of data transmission. As it helps in message delivery, it is not always stored physically, i.e. in a disk but ge
2 min read
JavaScript Course Understanding Code Structure in JavaScript
Inserting JavaScript into a webpage is much like inserting any other HTML content. The tags used to add JavaScript in HTML are &lt;script&gt; and &lt;/script&gt;. The code surrounded by the &lt;script&gt; and &lt;/script&gt; tags is called a script blog. The 'type' attribute was the most important attribute of &lt;script&gt; tag. However, it is no
4 min read
HTML Course Basics of HTML
In this article, we will go through all the basic stuff required to write HTML. There are various tags that we must consider and know about while starting to code in HTML. These tags help in the organization and basic formatting of elements in our script or web pages. These step-by-step procedures will guide you through the process of writing HTML.
5 min read
HTML DOM document plugins Property
The HTML DOM plugins property returns an HTMLCollectionobject containing one or more embed elements or plugins of the current document. This is a read-only property. Syntax: objects = document.plugins Return value: An HTMLCollection object, or "null" object,if there are no embedded elements or plugins in the document. Example: This example shows ho
1 min read
How to convert an HTML element or document into image ?
This article is going to tell and guide the users to convert a div element into an image using AngularJS. The user will be generating an image from the webpage and also be able to convert a particular part of the HTML page into the picture. Also, the user needs an HTML tag and html2canvas JavaScript library. By using this, we can create the picture
3 min read
How to specify an URL to a document that explains the reason why the text was deleted in HTML ?
The purpose of this article is to learn to specify a URL to a document that will explain, why the text was deleted. The HTML cite attribute specifies a URL to a document that explains the reason why the text was changed or deleted or inserted. The &lt;del&gt; tag in HTML is used to delete the text and mark a portion of the text which has been delet
1 min read
How to delete text from document using HTML ?
In this article, we delete text from an HTML document by using the &lt;del&gt; tag in the document. This tag stands for delete and is used to mark a portion of text which has been deleted from the document. Syntax: &lt;del&gt; Contents... &lt;/del&gt; Example: In the following example, deletion of a text from a document is demonstrated. &lt;!DOCTYP
1 min read
three90RightbarBannerImg