Coding/Learn/html/first page
HTML Beginner Course
01.Introduction to HTML
02.Anatomy of an HTML Element
03.The Sacred HTML5 Skeleton
04.Headings (h1 to h6)
05.Paragraphs, Line Breaks & Dividers
06.Text Formatting & Emphasis
07.Hyperlinks & Navigation (<a>)
08.Images & The Sacred Alt Text (<img>)
09.Ordered & Unordered Lists (<ul>, <ol>, <li>)
10.Block vs Inline Elements
11.Generic Containers (<div> & <span>)
12.Semantic HTML (<header>, <nav>, <main>, <footer>)
13.Tables (<table>, <tr>, <th>, <td>)
14.Native Audio & Video Elements
15.The Invisible Brain (<head> & Meta Tags)
16.Interactive Forms (<form>)
17.Input Types (<input>)
18.Accessible Labels & Submit Buttons
19.Textareas & Select Dropdowns (<textarea>, <select>)
20.Capstone: Building Your First Web Profile Page
Course Certificate0%

Complete all lessons to earn

LearnAnatomy of an HTML Element
2 / 20 0%
Lesson 02 of 20
5 mins read

Anatomy of an HTML Element

PreviousNext Lesson
In Plain English

An HTML element is the whole package: opening tag + inner content + closing tag. Think of tags like bread slices in a sandwich—if you forget the bottom slice, your sandwich falls apart.

The Mental Model

"HTML elements are like Russian nesting dolls. You can put an emphasis tag <em> inside a paragraph <p>, but you must close the inner doll before closing the outer doll!"

Deep Dive: How It Works

Opening tag: Tells the browser where the element starts, e.g., <p>.

Content: The text, image, or other HTML elements sitting inside the tags.

Closing tag: Tells the browser where the effect stops with a slash, e.g., </p>.

Nesting Rule: First opened, last closed. If you write <p><strong>Hello</strong></p>, the <strong> tag opened second, so it must close first.

Syntax Blueprint

<p>This is <strong>nested</strong> text.</p>

The inner <strong> tag closes before the outer <p> tag closes.

PointCore Rules to Remember

Point star
The Sandwich Rule: Opening tag is top bread, content is filling, closing tag is bottom bread.
Point star
Clean Nesting: Never overlap tags like <p><b>text</p></b>. Always close properly.
Point star
Whitespace Insensitive: Browsers collapse multiple spaces and newlines into a single space.

Common Beginner Traps & How to Fix Them

Mistake:Overlapping nested tags

Why it happens: Writing <p><b>Oops!</p></b> breaks standard document flow.

How to fix: Ensure inner tags are closed before outer tags: <p><b>Fixed!</b></p>.

Pro Tip: In HTML, hitting "Enter" ten times in your code editor will NOT create ten blank lines on the webpage—browsers ignore extra spaces!

Live Interactive Example

Hit Run Code to see it live
Properly Nested Elements
HTML5
1
Live Browser Preview
Click "Preview / Apply" to view the rendered output.
How it works: <strong> makes text bold while <em> adds emphasis italicization.

Your Turn: Micro Challenge

No pressure! Edit the starter code below and test your solution with instant feedback.

Micro Exercise

Nest a bold tag inside a paragraph

  • PointWrite a <p> tag with the text: "HTML is <strong>awesome</strong>."
1
2
Browser Preview & Output
Click "Check HTML" to test your solution.

Finished reading and practicing?

Mark this lesson as completed to update your course progress.

PreviousNext Lesson
Overview100 SheetLearnCertificates