HTML: The Foundational Guide for Every Developer

Table of contents
- What is HTML?
- π§ Why HTML Still Matters in 2025
- π³ HTML as a Tree
- π Elements, Tags & Nesting
- π Replaced vs Non-Replaced Elements
- π« Void Elements (Self-Closing Tags)
- ποΈ Attributes: Power Through Properties
- π§ HTML + JavaScript = DOM
- π§© Semantic HTML: Meaning Matters
- π Summary Cheat Sheet
- π§ͺ Practice Challenge
- π§ Final Thoughts
A definitive bookmark-worthy deep dive into HTML β its purpose, structure, elements, and philosophy. Whether you're just starting out or brushing up your fundamentals, this guide is designed to anchor your understanding at the core. Share it with someone starting HTML or refer back any time you need clarity.
What is HTML?
HTML (HyperText Markup Language) is the backbone of the web. It's not a programming language; it's a markup language that provides both the content and the structure of that content, which you see displayed in your browser.
HyperText: Text that links to other documents or resources
Markup: The annotation of content with tags
HTML is the content layer in a web page. Paired with:
CSS β presentation (look and feel)
JavaScript β behavior (interactivity)
π‘ Even modern JS frameworks like React ultimately manipulate HTML under the hood.
π§ Why HTML Still Matters in 2025
It's the root of semantic, accessible web development
It's critical for SEO, screen readers, and structured data
It's what JavaScript manipulates, and what CSS styles
No matter how advanced the tech stack, it all starts with HTML.
π³ HTML as a Tree
HTML documents form a tree of nodes, known as the DOM (Document Object Model):
Element Nodes: Represent HTML tags
Text Nodes: Represent the textual content inside elements
Your browser parses the HTML and generates this live tree. JavaScript can then access and manipulate it.
π Elements, Tags & Nesting
HTML consists of elements that are enclosed by tags written using angle brackets <>
.
<h1>Hello, world!</h1>
<h1>
: Opening tagHello, world!
: Content</h1>
: Closing tagElement: The entire block from opening tag to closing tag
β Good Practices:
Always close your tags (even optional ones)
Nest elements properly (closing in reverse order)
Indent for readability
HTML is forgiving but donβt depend on it:
<ul>
<li>Item 1
<li>Item 2
</ul>
This works, but it's poor practice.
π Replaced vs Non-Replaced Elements
π΅ Non-Replaced Elements
These elements are part of the pageβs document flow and can contain text or other elements:
<p>
,<h1>
β contain text<a>
,<div>
,<span>
β contain other elements
Theyβre not replaced by anything external. They define structure or inline meaning.
π£ Replaced Elements
These are replaced by some visual content or UI element:
<img>
,<input>
,<video>
,<iframe>
,<object>
Their appearance is defined externally or by the browser (like form inputs)
<input type="range">
<img src="cat.png" alt="A cute cat">
These are injected into the page as interface components or media.
π« Void Elements (Self-Closing Tags)
Void elements are self-closing. They do not have content or a closing tag:
Examples:
<br>
β line break<hr>
β horizontal rule<img>
,<input>
,<meta>
,<link>
,<source>
<input type="text" placeholder="Name" />
<img src="logo.png" alt="Site Logo" />
πΈ The slash (
/
) at the end is optional, but improves readability (and is XHTML style).
ποΈ Attributes: Power Through Properties
HTML elements can have attributes: extra information provided inside the opening tag.
<img src="avatar.png" alt="User profile" width="100" height="100">
src
: Source of the imagealt
: Description for screen readers (and fallback)width
/height
: Controls dimensions
π Attribute Rules
Always quote attribute values (
"value"
)Use lowercase for attribute names
Boolean attributes (like
checked
,disabled
) can be written without a value:
<input type="checkbox" checked>
π§ While HTML is not case-sensitive, many attribute values are. Especially for
id
,class
, and non-keyword strings.
π§ HTML + JavaScript = DOM
The DOM (Document Object Model) is the live structure of the page.
As HTML is parsed, each tag becomes an object in memory that JavaScript can manipulate:
<p id="greeting">Hello</p>
document.getElementById("greeting").textContent = "Hi there!";
Everything in HTML becomes a node in the DOM:
Element Node:
<p>
,<div>
, etc.Text Node: plain text inside the element
π§© Semantic HTML: Meaning Matters
Use semantic tags instead of just <div>
and <span>
.
Examples:
<header>
,<footer>
<article>
,<section>
<nav>
,<aside>
They add meaning to your structure and:
Improve accessibility
Help with SEO
Make your HTML more readable
<header>
<h1>101xDev Blog</h1>
</header>
π Summary Cheat Sheet
Tag | Purpose |
<p> | Paragraph |
<h1> -<h6> | Headings |
<a> | Hyperlink |
<ul> , <ol> , <li> | Lists |
<table> , <tr> , <td> | Tables |
<form> , <input> , <textarea> | Forms |
<img> | Images |
<div> , <span> | Generic Containers |
<header> , <footer> | Page Structure |
π§ͺ Practice Challenge
Try building a simple profile page:
Add a title and header
A profile image (
<img>
) with alt textA paragraph about yourself
A list of 3 favorite techs using
<ul>
A contact input form
πΈ Share your output on social media with #101xDevs and tag your learning journey!
Do Follow us on @SidTechX
π§ Final Thoughts
HTML is not just about making things "show up" on the screen β it's about creating structure with meaning.
Write HTML like you're writing a document meant to be understood by:
Browsers
Assistive technologies
Search engines
Other developers
Mastering HTML is the first real step in mastering the web.
π Bookmark this post. Share it with a friend starting HTML
Subscribe to my newsletter
Read articles from Siddartha directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
