Use of elements in HTML

Definition of Elements

HTML element is defined by start and end tag.HTML Element helps you to insert content.

where the element name is preceded by a forward slash as shown below with few tags −


Writing method of Element :

<tagname>Content goes here…</tagname> 

HTML Element writing method

As we know ,Elements that starts with start tag and end with end tag.

That is predicted by start tag <> and end tag    </>

Start tag Element content End tag
<h1> My First Heading </h1>
<p> My first paragraph. </p>

At the above example there is <h1> tag helps you to start write heading and </h1> is the closing point of heading.

When required to write the paragraph we start with <p> and completing the paragraph by closing </p>tag.

If we would like a paragraph break we use <br>.

Nested Element in HTML

HTML allows you to write nested element.When we try to design the webpages there we use nested element.

Its means elements can contain content.


<!DOCTYPE html>

<title>Nested Elements Example</title>

<h1>This is <i>italic</i> heading</h1>
<p>This is <u>underlined</u> paragraph </p>


Result of page

Below are the result of the above code.


This is italic heading

This is underlined paragraph

Lets understand HTML Tag

  • The <html> element defines the whole document.Its means the we are creating the webpages.
  • After the <html> there is <body> element.