HTML Basics for Beginners
HTML (HyperText Markup Language) is the language you use to describe the structure of a web page. It is not a programming language — it does not make decisions or do maths. Instead, it labels content so the browser knows what each piece is: this is a heading, this is a paragraph, this is a link. Every web page you have ever seen starts as HTML.
Tags, elements, and attributes
HTML is made of tags wrapped in angle brackets. Most tags come in pairs — an opening tag and a closing tag with a slash:
<!-- <p> opens a paragraph; </p> closes it.
The text in between is the element's content. -->
<p>This is a paragraph of text.</p>
- An element is the whole thing: opening tag, content, and closing tag.
- An attribute adds extra information inside the opening tag. For example, a link uses
hrefto say where it goes:
<!-- href is an attribute that holds the destination URL -->
<a href="https://www.infoplanet.in">Visit our site</a>
A few tags are self-closing because they have no content, such as the image and line-break tags:
<img src="cat.jpg" alt="A sleeping orange cat" />
<br />
Notice the alt attribute on the image — it describes the picture for screen readers and shows if the image fails to load. Always include it.
The skeleton of every page
Every HTML document follows the same basic structure:
<!DOCTYPE html> <!-- Tells the browser to use modern HTML rules -->
<html lang="en"> <!-- The root element; lang helps accessibility and SEO -->
<head>
<meta charset="UTF-8" /> <!-- Character encoding for all text -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Page</title> <!-- Shows in the browser tab -->
</head>
<body>
<!-- Everything the user sees lives inside <body> -->
<h1>Welcome</h1>
<p>This is my first web page.</p>
</body>
</html>
The <head> holds information about the page (its title, encoding, links to stylesheets). The <body> holds the visible content.
Want to learn this properly?
Join the waitlist for our courses — beginner-friendly, project-first classes in Jalgaon.
Browse coursesSemantic HTML: meaning, not just looks
Beginners often reach for <div> for everything. Modern HTML offers semantic elements that describe what content is, which helps search engines and assistive technology:
<header>
<nav>
<a href="/">Home</a>
<a href="/courses">Courses</a>
</nav>
</header>
<main>
<article>
<h1>Learning HTML</h1>
<p>HTML is the foundation of every web page.</p>
</article>
</main>
<footer>
<p>© 2026 My Site</p>
</footer>
Use <header>, <nav>, <main>, <article>, <section>, and <footer> where they fit. Reach for <div> only when no semantic element describes the content.
Common mistakes
- Forgetting to close tags. An unclosed
<p>or<li>can cause the rest of the page to render strangely. Pairs must match. - Skipping the
altattribute on images. This breaks accessibility and hurts SEO. - Using headings for size instead of structure.
<h1>to<h6>describe a document outline. Don't pick<h3>just because it "looks smaller" — use CSS to control size. - Wrapping everything in
<div>. Semantic elements communicate meaning that a plain<div>cannot. - Putting visible content in the
<head>. Only metadata belongs there; the user-facing content goes in<body>.
FAQ
Is HTML a programming language? No. It is a markup language — it structures and labels content. Logic and behaviour come from JavaScript.
Do I need to memorise every tag? No. You will use a couple of dozen tags most of the time. Keep a reference handy and the common ones become second nature quickly.
Keep learning
- Hub: Web Fundamentals
- Next: HTML Forms Explained
- Related: CSS Basics for Beginners
- Go further server-side with our PHP course
Want to build for the web? Explore our courses in Jalgaon.
Want to learn this properly?
Join the waitlist for our courses — beginner-friendly, project-first classes in Jalgaon.
Browse coursesFounder, Infoplanet
Atul Kabra founded Infoplanet in 2001 and has spent over two decades teaching programming — C, C++, Java, databases and more — to students across Maharashtra.
Related guides
CSS Flexbox Explained
Flexbox made simple: understand the main and cross axes and the handful of properties that arrange items in a row or column.
CSS Grid Explained
CSS Grid for beginners: build true two-dimensional layouts with rows and columns using grid-template, fr units, and gap.
Frontend vs Backend Development
A clear comparison of frontend and backend development: what each handles, the typical tools, and where full-stack sits between them.
