Your ultimate guide to HTML with clear explanations and examples in simple English.
HTML (HyperText Markup Language) is the foundation of webpages. It structures content like text, images, and videos for browsers to display.
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Page</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
Every HTML page starts with this structure. The <!DOCTYPE html>
declaration ensures proper rendering.
Attributes provide extra information to tags.
id
— Unique identifierclass
— CSS styling grouphref
— Link URLsrc
— Media sourcealt
— Image descriptionForms collect user input like text, selections, or files.
<form action="/submit" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<button type="submit">Submit</button>
</form>
Add images, audio, or videos to your page.
<img src="image.jpg" alt="Description">
<audio controls><source src="audio.mp3"></audio>
<video controls><source src="video.mp4"></video>
Tables organize data in rows and columns.
<table>
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Kanishk</td><td>15</td></tr>
</table>
Semantic tags improve structure and accessibility.
<header>
— Page header<nav>
— Navigation<main>
— Main content<section>
— Content section<article>
— Independent content<aside>
— Sidebar<footer>
— Page footerMeta tags provide metadata for SEO and responsiveness.
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Page description">
Links connect pages or resources.
<a href="https://example.com" target="_blank">Visit Example</a>
Create ordered or unordered lists.
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>Step 1</li>
<li>Step 2</li>
</ol>
Iframes embed external content.
<iframe src="https://example.com" width="100%" height="300"></iframe>
Canvas is used for drawing graphics with JavaScript.
<canvas id="myCanvas" width="200" height="100"></canvas>
SVG creates scalable vector graphics.
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" fill="blue" />
</svg>
Entities display special characters.
©
— ©<
— <>
— >&
— &Make your HTML accessible to all users.
alt
for images.aria-label
for screen readers.Optimize HTML for search engines.
<title>
.<meta name="description">
.Connect CSS to style your HTML.
<link rel="stylesheet" href="styles.css">
Add interactivity with JavaScript.
<script src="script.js"></script>
The doctype declaration tells browsers this is HTML5.
<!DOCTYPE html>
Block elements take full width; inline elements sit in line.
<div>
, <p>
, <h1>
<span>
, <a>
, <img>
Store custom data in HTML.
<div data-id="123">Content</div>
Attributes usable on any HTML element.
id
— Unique IDclass
— CSS classstyle
— Inline CSStitle
— Tooltip textWrite clean, maintainable HTML.
Comments
Comments help explain code but don’t display.