Welcome to Episode 3 of the Learn HTML series! In this episode, we will break down the very core of HTML — elements, tags, and attributes — to understand how webpages are built and structured.
By the end of this episode, you will:
- Understand the difference between elements and tags
- Know how to use attributes to customize HTML elements
- Learn the structure of a typical HTML element
- Identify opening vs closing tags
An HTML element is a combination of a start tag, content, and an end tag.
<p>This is a paragraph element.</p>
<p>→ Start tagThis is a paragraph element.→ Content</p>→ End tag
Tags are keywords enclosed in angle brackets (<>). They define the start or end of an element.
Example:
<h1>This is a heading</h1>
Some elements have no closing tag — these are called self-closing tags:
<img src="image.jpg" alt="Example image" />
Attributes provide additional information about an element. They are always written inside the start tag.
<a href="https://www.example.com" target="_blank">Visit Site</a>
In this example:
hrefis the attributehttps://www.example.comis the attribute value
| Attribute | Description |
|---|---|
href |
Specifies the URL for a link |
src |
Specifies the source of an image |
alt |
Provides alternative text for images |
title |
Provides extra info (tooltip) |
id |
Unique identifier for an element |
class |
Specifies class names (used with CSS) |
style |
Inline styling |
<a href="https://www.google.com" target="_blank" title="Go to Google">
Visit Google
</a>
a= anchor tag (creates a link)href= where it navigatestarget="_blank"= opens in a new tabtitle= shows tooltip on hover
<img /><input /><br /><hr /><meta />
These do not wrap any content and are closed within the opening tag.
- Tags mark the start and end of elements.
- Attributes customize elements and add functionality.
- Elements are the basic building blocks of every webpage.
➡️ Episode 4: Boolean Attributes in HTML
Mastering elements, tags, and attributes is the first step toward building powerful web pages. Let's keep going! 💡🌐