HTML Basics
The skeleton of the web! ðĶīð§ Build your first web page from scratch.
1 What is HTML?
HTML stands for HyperText Markup Language. Think of it like building a cheese house â HTML provides the blocks of cheese to build the walls, roof, and doors. Without HTML, there is no web page!
Every page you visit on the internet â Google, YouTube, your favourite games site â all starts with HTML. It tells the browser what content to show: headings, paragraphs, images, buttons, and more.
Elements and Tags
HTML uses tags to wrap content. Most tags have an opening part like <p> and a closing part like </p>. Together they form an element.
<h1>Welcome to CHEESY Education!</h1>
<p>This is a paragraph about how much we love cheese.</p>
Welcome to CHEESY Education!
This is a paragraph about how much we love cheese.
2 Document Structure
Every proper HTML document has the same basic structure. It always starts with a <!DOCTYPE html> declaration, followed by the <html> element which wraps everything.
Inside <html> there are two main sections: <head> (invisible info like the title and styles) and <body> (the visible content the user sees).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>My Cheesy Page</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>My first web page ð§</p>
</body>
</html>
3 Headings and Paragraphs
HTML has 6 levels of headings: <h1> through <h6>. Use <h1> for the main title (largest), and smaller numbers for subtitles. The <p> tag is for paragraphs of text.
<h1>The Biggest Heading (h1)</h1>
<h2>Second Biggest (h2)</h2>
<h3>Third Biggest (h3)</h3>
<p>A regular paragraph of text. Use it for longer descriptions.</p>
The Biggest Heading (h1)
Second Biggest (h2)
Third Biggest (h3)
A regular paragraph of text. Use it for longer descriptions.
4 Links and Images
Use the <a> tag to create hyperlinks. The href attribute tells the browser where to go. The <img> tag displays images â notice it has no closing tag! The src attribute is the image URL, and alt is a text description for accessibility.
<!-- A link that opens in a new tab -->
<a href="https://example.com" target="_blank">
Click here for more cheese!
</a>
<!-- An image (self-closing tag) -->
<img src="cheese.png" alt="A delicious piece of cheese" />
5 Lists
Use <ul> for an unordered (bullet) list and <ol> for an ordered (numbered) list. Each item goes inside a <li> tag. Perfect for listing your favourite cheeses!
<h3>My Favorite Cheeses</h3>
<ul>
<li>Cheddar</li>
<li>Gouda</li>
<li>Brie</li>
</ul>
<h3>Steps to Make Grilled Cheese</h3>
<ol>
<li>Butter the bread</li>
<li>Add cheese slices</li>
<li>Grill until golden ð§</li>
</ol>
My Favorite Cheeses
- Cheddar
- Gouda
- Brie
Steps to Make Grilled Cheese
- Butter the bread
- Add cheese slices
- Grill until golden ð§
6 Forms and Inputs
Forms let users enter data. Use the <form> tag to wrap your form, <input> for text fields, and <button> to submit. The type attribute on <input> changes what kind of field it is (text, email, password, checkbox, etc.).
<form>
<label for="name">Your Name:</label>
<input type="text" id="name" placeholder="Enter your name" />
<label for="fav-cheese">Favorite Cheese:</label>
<select id="fav-cheese">
<option>Cheddar</option>
<option>Gouda</option>
<option>Brie</option>
</select>
<button type="submit">Submit ð§</button>
</form>
7 Divs and Spans
<div> is a block-level container â it takes up the full width and starts on a new line. <span> is an inline container â it wraps text within a line without breaking it. Both are super useful for styling and layout!
<div style="background: #FFF3B0; padding: 1rem; border-radius: 8px;">
<h2>I am a block element inside a div</h2>
<p>
I love <span style="color: orange; font-weight: bold;">cheesy</span> code!
</p>
</div>
I am a block element inside a div
I love cheesy code!
ð Quick Reference Card
Here are the most important HTML tags you just learned:
| Tag | Purpose | Example |
|---|---|---|
<h1>â<h6> | Headings | <h1>Title</h1> |
<p> | Paragraph | <p>Text</p> |
<a> | Hyperlink | <a href="...">Click</a> |
<img> | Image | <img src="..." alt="..." /> |
<ul> / <ol> | Lists | <ul><li>Item</li></ul> |
<div> | Block container | <div class="...">...</div> |
<span> | Inline container | <span style="...">text</span> |