HTML Tags
HTML tags are the building blocks of a webpage used to wrap content in a specific way, defining the type and style of content.
Tags are usually enclosed in angle brackets, like this: <tagname>
. Most tags come in pairs, with an opening tag <tagname>
and a closing tag </tagname>
, although some are self-closing.
Understanding how HTML tags work is crucial for creating your own websites. This tutorial will guide you through the essential HTML tags and how to use them effectively.
Example:
<p>This is a paragraph.</p>
In this example, <P>
is the opening tag, and </P>
is the closing tag. The text inside these tags, 'This is a paragraph.', is the content that will be displayed on the webpage.
HTML Tags Examples
<h1> to <h6>
These tags define headings, with <h1>
being the most important (usually the main heading) and <h6>
the least important.
<h1>Main Heading</h1>
<h2>Subheading</h2>
<a>
Defines a hyperlink, which allows users to click and navigate to another page or resource.
<a href="https://www.example.com">Visit Example</a>
<body>
Contains the content of the HTML document, such as text, images, and links. Everything visible on the webpage is inside the <body>
tag.
<body>
<h1>Hello World!</h1>
</body>