CHAPTER 00
Beginner
HTML Basics for Beginners
Updated: Jun 5, 2026
15 min read
Introduction
What is HTML?
HTML stands for HyperText Markup Language. It is the standard language used to create and design websites. Think of HTML as the skeleton of a webpage—it provides the basic structure and content, such as text, images, and links, upon which everything else is built.Why HTML is Important
Without HTML, the web as we know it would not exist. Every single website on the internet, from Google to Facebook, uses HTML. It is the fundamental building block of web development and the absolute first skill any aspiring developer must learn.History of HTML
Created by Tim Berners-Lee in 1991, HTML started as a simple text-formatting tool for scientists to share documents. Over the decades, it evolved through several versions. Today, the world uses HTML5, the latest, most powerful version that supports modern multimedia like video and audio natively.How Browsers Read HTML
Web browsers (like Chrome, Safari, or Firefox) act as translators. They read your raw HTML code from top to bottom and render (display) it visually on the screen for users to interact with. Browsers do not display the HTML tags themselves; they use the tags to determine *how* to present the content.Frontend vs Backend
- Frontend: What the user sees and interacts with. HTML, along with CSS (styling) and JavaScript (interactivity), makes up the frontend.
- Backend: The hidden server-side logic (databases, user authentication) powered by languages like PHP, Python, or Node.js.
HTML Document Structure
Every HTML file must follow a specific skeleton to be understood by browsers.
html
Explanation of the Structure:
-
<!DOCTYPE html>: Declares that this document is an HTML5 document.
-
<html>: The root element that wraps all content on the page.
-
<head>: The container for metadata. Nothing in the head is visible on the webpage.
-
<meta>: Defines character sets, viewport settings, and SEO descriptions.
-
<title>: Sets the title of the page.
-
<body>: The container for all the visible content.
HTML Elements & Tags
Opening and Closing Tags
HTML uses a tag-based syntax. Most elements have an opening tag and a closing tag.<h1>This is a heading</h1>
Self-Closing Tags
Some elements don't wrap content, so they don't need a closing tag.<img src="photo.jpg" alt="A photo"> or <br>
Nested Elements
Elements can be placed inside other elements.
html
Attributes
Attributes provide extra information about an element.-
id="header": Unique identifier.
-
class="btn-primary": Class for CSS styling.
-
href="https://google.com": Destination URL for a link.
-
src="image.jpg": Source file for an image.
-
alt="Description": Alternative text for images.
Text Elements
-
Headings:
<h1>to<h6>.
-
Paragraphs:
<p>.
-
Bold / Strong:
<b>makes text bold.<strong>indicates semantic importance.
-
Italic / Emphasis:
<i>italicizes.<em>adds semantic emphasis.
-
Line Break:
<br>.
-
Horizontal Rule:
<hr>.
Links & Images
html
Lists
html
Tables
html
Forms
html
Semantic HTML
-
<header>: Introductory content.
-
<nav>: Primary navigation links.
-
<main>: Dominant content.
-
<section>: Standalone section.
-
<article>: Self-contained content.
-
<footer>: Bottom footer.
HTML5 Features
html
Comments & Best Practices
<!-- This is a comment -->
- 1. Proper Indentation.
- 2. Lowercase Tags.
-
3.
Always use
alttags.
- 4. Semantic Structure.
Common Beginner Mistakes
- 1. Forgetting to close tags.
-
2.
Improper Nesting:
<b><p>Wrong</b></p>.
-
3.
Using
<h1>for styling.
-
4.
Missing
<!DOCTYPE html>.
-
5.
Inline CSS:
<p style="color:red">.
-
6.
Missing
altattributes on images.
-
7.
Using
<br>for spacing instead of CSS margin.
-
8.
Typos in attributes:
hfer="link".
- 9. Div soup.
- 10. Capitalizing tags.