What is HTML?
HTML stands for HyperText Markup Language. It defines the structure and meaning of web content using elements (tags). Every website you visit is built on HTML.
📄 Markup Language
HTML uses tags to annotate text and define its role: heading, paragraph, link, image, etc.
🌐 Rendered by Browsers
Browsers read HTML and display it visually. They hide the tags and show only the content.
🧱 Foundation Layer
HTML is the base layer. CSS adds styling, JavaScript adds behaviour — but HTML is always first.
Document Structure
Every HTML file follows the same skeleton. Here is the minimal template that every page starts with:
<!-- Every HTML page starts with this --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My First Page</title> </head> <body> <h1>Hello, World!</h1> <p>This is a paragraph.</p> </body> </html>
<!DOCTYPE html>
Tells the browser this is an HTML5 document. Always the very first line.
<head>
Contains invisible metadata: character set, page title, links to stylesheets and scripts.
<body>
Everything visible on the page goes here — text, images, buttons, menus.
Essential Tags
These are the most commonly used HTML tags. Memorize these and you can build any basic page.
| Tag | Use | Example |
|---|---|---|
| <h1>–<h6> | Headings, h1 = largest | <h1>Title</h1> |
| <p> | Paragraph of text | <p>Hello</p> |
| <a> | Hyperlink | <a href="#">Click</a> |
| <img> | Image | <img src="cat.jpg"> |
| <ul> / <ol> | Unordered / ordered list | <ul><li>Item</li></ul> |
| <div> | Generic container block | <div class="box">…</div> |
| <span> | Inline container | <span>word</span> |
| <br> | Line break (self-closing) | Line 1<br>Line 2 |
| <strong> | Bold / important text | <strong>Bold</strong> |
| <em> | Italic / emphasis | <em>Italic</em> |
| <table> | Data table | <table><tr><td>… |
| <button> | Clickable button | <button>OK</button> |
Attributes
Attributes provide extra information about elements. They are written inside the opening tag as name="value" pairs.
<!-- href is an attribute of <a> --> <a href="https://example.com" target="_blank">Open Link</a> <!-- src and alt are attributes of <img> --> <img src="photo.jpg" alt="A photo" width="300"> <!-- id and class are universal attributes --> <div id="header" class="container dark">…</div>
id must be unique on the page. The class can be reused on many elements and is the main way CSS targets elements.Forms & Inputs
Forms collect user input — login data, search queries, signup info. Every interactive website uses them.
<form action="/login" method="post"> <label for="user">Username:</label> <input type="text" id="user" name="username" placeholder="Enter name"> <label for="pass">Password:</label> <input type="password" id="pass" name="password"> <button type="submit">Login</button> </form>
type="text"
Single-line text input.
type="password"
Hides typed characters.
type="email"
Validates email format automatically.
type="checkbox"
On/off toggle box.
type="radio"
Pick one from a group.
<textarea>
Multi-line text input.
Semantic HTML
Semantic tags describe the meaning of content, not just its appearance. They improve accessibility and SEO.
<header> <nav>…</nav> </header> <main> <article> <h2>Blog Post Title</h2> <section>…</section> </article> <aside>Related Links</aside> </main> <footer>© 2026</footer>
<div> for styling/layout purposes only. Use semantic tags like <header>, <main>, <footer>, <article> when the content has a clear meaning.Links & Images
Hyperlinks connect pages together and images make the web visual. These two tags are used on every site.
<!-- External link, opens in new tab --> <a href="https://google.com" target="_blank">Google</a> <!-- Internal link to another page --> <a href="about.html">About Us</a> <!-- Anchor link on same page --> <a href="#contact">Jump to Contact</a>
<!-- Always include alt text for accessibility --> <img src="logo.png" alt="Company Logo" width="200"> <!-- Clickable image --> <a href="gallery.html"> <img src="thumb.jpg" alt="View Gallery"> </a>
🛠 First Project: Personal Card
Put it all together! Build your first HTML page — a personal profile card using everything you've learned.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>My Profile</title> </head> <body> <header> <h1>John Doe</h1> <p>Junior Web Developer</p> </header> <main> <img src="avatar.jpg" alt="Profile photo" width="120"> <section> <h2>About Me</h2> <p>I love building websites and learning new tech.</p> </section> <section> <h2>Skills</h2> <ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ul> </section> </main> <footer> <p>Contact: <a href="mailto:john@example.com">john@example.com</a></p> </footer> </body> </html>