HTML Tags
Written by
There are several different elements in HTML. Each element has an opening and a closing tag.
HTML tags are the label pieces of content such as hearing, paragraphs, tables, images etc. Tags act like containers. They tell you something about the information that lies between their opening and closing tags.
Browsers don’t display HTML tags but use them to render the content of the page.
Taking a simple example to understand tags:
<! DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Heading</h1>
<p>Paragraph</p>
</body>
</html>
The <!DOCTYPE html> declaration defines this document to be HTML5. The <html> element is the root element of the HTML page.
The <head> element contains the meta-information about the document.
The < title > element specifies the title of the document.
The <body > element contains the content which is to be displayed by the browser.
The < h1 > element defines a large heading. There is a total of six sizes of headings ranging from h1 to h6.
The <p > element defines the paragraph. These are the most important tags used in HTML. There are several other tags which are used and they will be covered in upcoming chapters.
HTML tags are element names surrounded by angular brackets.
HTML tags normally come in pairs like <p> and </p>. The first tag in the pair is the start tag and the second tag is the end tag. The end tag is written like the start tag, but with a forward slash inserted before the tag name. The characters in the bracket indicate the tag purpose.
Attributes tell us more about elements, so we take a look at HTML elements in the next chapter.