HTML Tags: A Fundamental Overview
In HTML (Hypertext Markup Language), a tag is a fundamental component used to define and structure
the content of a web page. HTML tags are used to enclose and describe elements or components within the page,
providing instructions to web browsers on how to render and display the content. HTML tags are typically enclosed
within angle brackets (“<>”) and come in pairs: an opening tag and a closing tag.
Opening tag: It begins with the less-than sign (“<”). For example: <tag>
.
Closing tag: It is similar to the opening tag but includes a forward slash (“/”) before the tag
name. For example: </tag>
.
The content you want to apply the tag to is placed between the opening and closing tags. For example, if you want
to create a paragraph of text, you would use the <p>
tag like this:
<p>This is a paragraph of text.</p>
.
Common HTML Tags and Their Purpose
html:
Defines the beginning and end of an HTML document.head:
Contains metadata about the document, such as the title and links to stylesheets.title:
Sets the title of the web page, which is displayed in the browser’s title bar or tab.body:
Contains the visible content of the web page.h1, h2, h3, and so on:
Create headlines of various levels.p:
Defines a paragraph of text.a:
Creates a hyperlink to other web pages or resources.img:
Embeds images.ul:
Creates an unordered (bulleted) list.ol:
Creates an ordered (numbered) list.li:
Defines list items betweenul
andol
elements.div:
A generic container for grouping and styling elements.span:
A generic inline container for styling part of text.
HTML tags are the building blocks of web pages and are used to structure and format the content for web browsers to render and display correctly.