a tag is a label or keyword enclosed in angle brackets (< >) that serves as a fundamental building block for defining the structure and content of a webpage. Tags instruct the web browser on how to display content, such as text, images, or links.
Key Characteristics of HTML Tags
Syntax: Tags are written as a keyword inside angle brackets, for example, <p>.
Pairs (Mostly): Most tags come in pairs: an opening tag (e.g., <p>) and a closing tag (e.g., </p>). The closing tag includes a forward slash before the tag name.
Content Container: The content placed between the opening and closing tags is what the tag affects. The entire unit (opening tag, content, and closing tag) is called an HTML element.
Void Elements: Some tags are known as "void" or "self-closing" elements because they do not wrap content and do not require a closing tag. Examples include the <img> tag for images and the <br> tag for line breaks.
GeeksforGeeks +4
Example
A paragraph element is created using the paragraph tags:
html
<p>This is a paragraph of text.</p>
Here, <p> is the opening tag, </p> is the closing tag, and "This is a paragraph of text." is the content.
The Odin Project +3
Common HTML Tags
Tag Name
Description
<html>
Defines the root of the HTML document
<head>
Contains meta-information about the document (not visible on the page)
<body>
Contains all the visible content of the webpage
<h1> to <h6>
Define different levels of headings
<p>
Defines a paragraph
<a>
Defines a hyperlink
<img>
Embeds an image
<div>
Defines a division or a section in an HTML document
Elements and Tags | The Odin Project
-- Edited by saleh on Friday 13th of March 2026 06:30:31 AM
-- Edited by saleh on Friday 13th of March 2026 06:31:40 AM