HTML Document



First HTML Example :

<!DOCTYPE html>
<html>
<body>

<h1>This is Heading</h1>
<p>This is Paragraph</p>

</body>
</html>

Explanation of Example

Tag Explanation
<!DOCTYPE html>
This will define HTML document
<html> and </html>
Text between html tag will describe the webpage
<body> and </body>
Text between the body tag is only visible content on the webpage
<h1> and </h1>
Text between the h1 tag displays Heading
<p> and </p>
Text between the p tag displays paragraph

HTML Tags

  1. Web Page consists of HTML tags which is basic building block of Web Page.
  2. HTML Tags are Keywords surrounded with starting angular bracket and closing angular bracket
  3. Generally each HTML tag comes in a pair except some tags which do not have closing tags.
  4. Starting tag is also known as opening Tag while ending tag is also known as closing tag

HTML document structure

Structure of HTML

HTML document rules

HTML elements can be nested

HTML tags can be nested. One HTML Element can have other HTML elements inside it. e.g –

<body>
    <h1><b>This is a Heading</b></h1>
    <b>Text is bold</b>
</body>

in the above HTML markup, We have nested the HTML elements.

HTML documents are case-insensitive

We can write HTML code in either cases i.e in Uppercase or in lowercase.

<h1><b>This is a Heading</b></h1>

and

<H1><b>This is a Heading</B></h1>

both of the above lines will print same result.