Getting Started Lesson 4 of 42
HTML Elements and Tags Explained
Learn the difference between tags and elements, opening and closing tags, empty (void) elements like br and img, and how to nest elements properly.
People often use the words "tag" and "element" as if they were the same thing. They are close, but not identical. Knowing the difference will help you understand error messages, read documentation, and talk like a real developer.
Tag vs. element
Look at this line:
<p>Masarap ang adobo ni Lola.</p>
<p>is the opening tag.</p>is the closing tag. It looks the same, but with a forward slash/before the name.- "Masarap ang adobo ni Lola." is the content.
- The whole thing — opening tag + content + closing tag — is the element.
So a tag is just the label in angle brackets, while an element is the complete package. When someone says "the paragraph element," they mean the whole thing.
Elements can contain other elements
An element's content can be text, other elements, or both. Here the paragraph contains text and a <strong> element that makes a word important:
<p>The flag ceremony starts at <strong>7:00 AM sharp</strong>. Don't be late!</p>
<p>Bring your <em>ID</em> and your <strong>assignment notebook</strong>.</p>
Empty (void) elements
Some elements have no content at all, so they don't need a closing tag. They are called empty elements or void elements. The most common ones are:
| Element | What it does |
|---|---|
<br> | A line break (goes to the next line) |
<hr> | A horizontal line that separates sections |
<img> | Shows an image |
<input> | A form field, like a text box |
<meta> | Information about the page, inside the head |
<link> | Connects a file, like a CSS stylesheet |
<p>Barangay San Isidro<br>
Purok 3, Zone 5<br>
Quezon City</p>
<hr>
<p>Office hours: Monday to Friday, 8 AM – 5 PM</p>
Block elements and inline elements
Elements behave in one of two main ways when the browser places them on the page:
- Block elements start on a new line and stretch across the full width available. Examples:
<h1>,<p>,<div>,<ul>,<table>. - Inline elements stay in the same line as the text around them and only take up as much space as they need. Examples:
<strong>,<em>,<a>,<span>,<img>.
Think of block elements as the rows of seats in a jeepney, and inline elements as the passengers sitting in a row. We will go deeper into this in the lesson on Block and Inline Elements.
Forgetting the closing tag
Browsers are very forgiving. If you forget a closing tag, the browser tries to guess where it should be. Sometimes it guesses right. Sometimes it doesn't, and your whole page starts looking bold or italic.
<p>This is <strong>important news!</p>
<p>Wait... why is this paragraph also bold?</p>
<p>And this one too!</p>
Open the example and add </strong> right after "important news!" to fix it. Small mistakes like this are the reason we always close our tags.
Element names are not case sensitive
<P>, <p> — both work. But the standard practice is lowercase, and some tools even warn you about uppercase tags. Stay consistent and use lowercase everywhere.
Quick Quiz
Check what you learned. Walang grade ito, practice lang. 🙂
By Sir Reyel · Last updated 2026-12-04