HTML Tags and Elements


HTML web page consists of Elements and Tags. Let us understand them in detail.


The < tag-name > make a HTML tag. For example <p> is a Paragraph tag.


Opening < tag-name > some content followed by closing </ tag-name > make a HTML element. For example <h1> Hello World!</h1> is an element consisting of opening heading tag then a text "Hello World" followed by closing heading tag.

Open and close Tags

In HTML code you have to open and close tags to make an HTML element. That is, a content must be enclosed within a matching opening and closing tags to make up a HTML element.

Conside the following HTML code.

	<h1>Hello World!</h2>

The opening and closing body tag encloses the h1 tag. And the opening and closing h1 tag encloses the text "Hello World!".

If the tags are not properly matched and closed then it gives unexpected or invalid result.

For example, conside the following invalid HTML code.

	</body>Hello World!</h1>

Empty Elements

These are the HTML elements without any content. For example the break line tag <br> has no closing tag and no content. So, its an empty element.