HTML Course | Structure of an HTML Document

Course Navigation

The <HTML> is a markup language which is used by the browser to manipulate text, images and other content to display it in required format.

Tags in HTML: Tags are one of the most important part in an HTML Document. HTML uses some predefined tags which tells the browser about content display property, that is how to display a particular given content. For Example, to create a paragraph, one must use the paragraph tags(<p> </p>) and to insert an image one must use the img tags(<img />).

There are generally two types of tags in HTML:

  1. Paired Tags: These tags come in pairs. That is they have both opening(< >) and closing(</ >) tags.
  2. Singular Tags: These tags do not required to be closed.

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



Structure of an HTML Document

An HTML Document is mainly divided into two parts:

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

Let us now have a look on the basic structure of HTML. That is the code which is must for every webpage to have:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
  
<html>
    <head>
        <title>
              
        </title>
    </head>
      
    <body>
          
    </body>
</html>

chevron_right


Every Webpage must contain this code. Below is the complete explanation of each of the tags used in the above piece of HTML code:

<DOCTYPE! html>: This tag is used to tells the HTML version. This currently tells that the version is HTML 5.

<html>: This is called HTML root element and used to wrap all the code.

<head>: Head tag contains metadata, title, page CSS etc. All the HTML elements that can be used inside the <head> element are:

  • <style>
  • <title>
  • <base>
  • <noscript>
  • <script>
  • <meta>
  • <title>
  • We will learn about these in details later.

<body>: Body tag is used to enclosed all the data which a web page has from texts to links. All of the content that you see rendered in the browser is contained within this element.

To learn more about an HTML Document structure, please visit:



My Personal Notes arrow_drop_up

Senior Technical Content Engineer | GeeksforGeeks

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.