Build the structure of real web pages: text, links, images, lists, tables, forms and semantic layout.
Every example opens in a live browser preview. Click ✎ Edit on any preview, or press L, to open the Code Lab.
https://www.ranchi-school.in/about.html| Postal address | URL part |
|---|---|
| India Post / courier | https:// |
| Ranchi city | ranchi-school.in |
| Lane / building | /notices |
| Your house number | /exam.html |
D:\my-website and open it: File > Open Folderindex.html, type ! and press Tab for a ready templateindex.html.txt (turn on "File name extensions" in Windows Explorer). Spaces or capital letters in file names: use about-us.html not About Us.html.<p>, <h1>, <img>. Tells the browser what kind of thing it is.<h1>Hello</h1> is one element.<br> (new line), <hr> (line), <img> (picture).An element can live inside another element. The one opened last must be closed first – like closing the inner tiffin box before the outer bag.
| Line | What it means |
|---|---|
<!DOCTYPE html> | Tells the browser: this is modern HTML5 |
<html lang="en"> | The root – everything goes inside. lang = page language |
<head> | Hidden information about the page (title, settings) |
<meta charset> | Supports all letters: Hindi, ₹, emojis |
<title> | Text shown on the browser tab |
<body> | Everything visible on the page goes here |
The browser reads your file top to bottom and builds a family tree called the DOM (Document Object Model).
html is the parent of head and bodyh1 and p are children of body and siblings of each other| Shortcut | What it does |
|---|---|
| Ctrl+U | View the HTML source of any website |
| F12 | Open Developer Tools (DevTools) |
| Right-click > Inspect | Jump straight to that element in the code |
| Ctrl+Shift+M | (in DevTools) see the page on a phone screen |
| Ctrl+R | Reload the page after saving |
<p> about your school. Try deleting a closing </p> – what happens? Click Full screen to download your file.index.html with the full HTML skeleton<h1> with her name<hr> line and a final line "Made by Riya"! then Tab in VS Code to get the skeleton.<h2> "Famous Places"<br> to put each place on a new line<br>.<h1> is never closed<title> is placed inside body<b><i>...</b></i><!-- ... --><h1>: Class 7 Picnic<b> for the important words<hr> and a heading <h3> "Things to bring"<br>Module 2: Text & Headings – make your words look like a real article.
Q1. Where do you write everything that is VISIBLE on the page?
Q2. Which one is correct nesting?
Q3. Which language decides the COLOUR of a heading?
<h1> just to make text big, or <h6> just to make it small. Wrong headings confuse Google and screen readers.| Tag | Use it for |
|---|---|
<p> | A block of text (paragraph) |
<br> | A line break inside a paragraph (addresses, poems) |
<hr> | A thematic break: a line between topics |
<br>, <p> or CSS for spacing.| Tag | Looks like | Meaning |
|---|---|---|
<strong> | bold | Very important |
<em> | italic | Stress / emphasis |
<mark> | highlight | Highlighted for attention |
<del> <ins> | Removed / inserted text | |
<sub> <sup> | H2O x2 | Subscript / superscript |
<small> | fine print | Side comments, legal text |
<b> <i> <u> | b i u | Style only, no extra meaning |
<strong> tells screen readers "this is important" so prefer it for warnings. Use <b> for product names or keywords.| Tag | Used for |
|---|---|
<blockquote> | A long quote, shown indented |
<q> | Short quote, browser adds " " |
<abbr title> | Short form; hover to see full form |
<kbd> <code> | Keyboard keys and code |
<pre> | Keeps spaces and line breaks exactly |
| You want | Type this | Why |
|---|---|---|
| < > | < > | < would start a tag! |
| & | & | & starts an entity |
| ₹ | ₹ | Indian Rupee sign |
| © | © | Copyright in footers |
| ® ™ | ® ™ | Brand marks |
| (space) | | Space that never breaks or squeezes |
| ♥ ★ | ♥ ★ | Symbols, ratings |
& and ends with ;. Named (©) or numbered (©).<meta charset="UTF-8"> lets the page show Hindi, Bengali, Santhali (Ol Chiki) and emojislang="hi" tells Google and screen readers the page is in Hindilang="en" on that element<h3> "Chief Guest" with a paragraph. Highlight the winner names with <mark>. Add a price "₹ 50 entry fee".<h1>: NOTICE<h2> with the subject: Parent-Teacher Meeting<strong><mark><br> and a <small> footer<h1> headline and a <h4> byline<em> and <strong><blockquote><h2> "What happens next"<abbr> for NSS (National Service Scheme)<h3> Chemistry: H2O, CO2, H2SO4<h3> Maths: a2 + b2 = c2, area = πr2π and × entities<b>, old price in <del>, new price in <ins>₹ so "₹ 400" never breaks© and <small><html lang="hi"> and UTF-8<pre> so spacing is kept<cite><blockquote>lang="en"Module 3: Links, Images & Media – connect pages and add pictures, video and maps.
Q1. How many <h1> headings should a page normally have?
Q2. You typed 5 spaces between two words. How many does the browser show?
Q3. Which shows the Rupee sign?
₹ is the numbered entity for ₹.<a>...</a>.target="_blank" add rel="noopener". It stops the new page from controlling your page.id="contact".| href starts with | Opens |
|---|---|
https:// | Another website |
page.html | A page in your folder |
#id | A section of the same page |
mailto: / tel: | Email app / phone dialler |
| Type | Example | Use for |
|---|---|---|
| Absolute | https://site.com/img/a.jpg | Files on other websites |
| Relative (same folder) | about.html | Pages next to each other |
| Relative (sub-folder) | images/logo.png | Go DOWN into a folder |
| Relative (parent) | ../index.html | Go UP one folder |
src="C:\Users\Aman\Desktop\logo.png" works only on YOUR computer. Online it breaks. Always use relative paths for your own files./, not backslash.Smaller files = faster pages, less mobile data. Exact sizes vary by image.
| Format | Best for | Note |
|---|---|---|
| JPG | Photos (Hundru Falls, food) | Small size, no transparency |
| PNG | Screenshots, logos with transparent background | Sharp but large for photos |
| WebP | Modern replacement for JPG/PNG | Smallest; all new browsers support it |
| GIF | Tiny simple animations | Only 256 colours |
| SVG | Logos, icons, diagrams | Drawn with code, sharp at any size |
<figure> groups an image with its caption<figcaption> is the caption text (top or bottom)<img> inside <a> to make a clickable logo or banner| Attribute | What it does |
|---|---|
controls | Shows play / pause / volume buttons |
poster | Picture shown before the video plays |
autoplay muted | Starts by itself (browsers allow it only when muted) |
loop | Plays again and again (background videos) |
betla.jpg to netarhat.jpg. Add a temple.jpg figure. Break a path on purpose and watch the alt text appear. Other images available: ranchi.jpg, school.jpg, thekua.jpg, samosa.jpg.<h1><figure> blocks with <img> and <figcaption>images foldertel:mailto: and a subjecthttps://wa.me/91...rel="noopener"id="top"#history, #rivers, #festivalshref="#top")<iframe> (title + loading="lazy")Module 4: Lists & Tables – organise information like menus, timetables and marksheets.
Q1. Your page is in pages/about.html. How do you show images/logo.png?
../ goes up from pages/ to my-website/, then into images/.Q2. Why is the alt attribute important?
Q3. Which link opens the phone dialler?
<ul> you can only put <li>. A nested list goes inside an <li>, before its closing tag.<ul> = unordered list (order does not matter)<li> = list item| Attribute | Example | Result |
|---|---|---|
type | "1" "A" "a" "I" "i" | 1, A, a, I, i |
start | start="4" | begins at 4 (IV) |
reversed | (no value) | counts down 3, 2, 1 |
<ul><a> inside <li><tr>). Inside each row put cells: <th> for headings (bold, centred) or <td> for data. border="1" is a quick test border – in Part 2 we use CSS instead.| Tag | Purpose |
|---|---|
<caption> | Title of the table (shown above it) |
<thead> | Header rows |
<tbody> | Main data rows |
<tfoot> | Totals / summary row |
scope | Tells screen readers if a th is for a column or row |
<tfoot>. Change <ul> to <ol type="a">. Merge the heading across 3 columns with colspan.<h2> Ingredients as an unordered list<h2> Method as an ordered list (5 steps)<strong> at the end<dl>, <dt>, <dd><strong> inside dtrowspan="3"<th> for day names<thead>: Subject, Max Marks, Marks Obtained<tbody> with 5 subjects<tfoot> with Total and Percentage (use colspan)<mark>colspan="5"scope="col" on headersModule 5: Forms & User Input – collect names, phone numbers and feedback from visitors.
Q1. Which tag makes a numbered list?
Q2. A cell should cover 2 columns. Which attribute?
Q3. Should you use a table to create a page layout with a sidebar?
name. The text the user typed is the value.| Piece | Job |
|---|---|
<form action method> | Container. action = where to send, method = how |
<label for="sname"> | Text for the box. Clicking it focuses the box |
<input id="sname"> | The box. id matches label for |
name="student_name" | The key sent to the server |
student_name=...&mobile=...type="tel" opens the number keypad, type="email" shows the @ key, and type="date" shows a calendar. Users love it!| Radio ◉ | Checkbox ☑ | |
|---|---|---|
| How many? | Only one from the group | Zero, one or many |
| Grouped by | Same name | Same name (optional) |
| Example | Gender, payment method | Hobbies, "I agree to terms" |
| Pre-select | checked | checked |
| Tag | Use when |
|---|---|
<select> + <option> | Many fixed choices (districts, states) |
<optgroup> | Group options under a heading |
<textarea> | Long text: address, message, feedback |
<datalist> | Suggestions while typing, but free text allowed |
| Attribute | Rule |
|---|---|
required | Cannot be empty |
minlength / maxlength | Number of characters |
min / max | Smallest / biggest number or date |
pattern | Must match a pattern (here: Indian mobile) |
readonly / disabled | Cannot edit (disabled is not even sent) |
<fieldset> draws a box around related fields<legend> is the title on the box| GET | POST | |
|---|---|---|
| Data visible in URL? | Yes | No |
| Can bookmark / share? | Yes | No |
| Good for | Search, filters | Login, payment, sign-up |
| Size limit | Small | Large (files) |
| Default? | Yes (if no method) | Must write method="post" |
type="file" use method="post" enctype="multipart/form-data".type="tel" and a pattern. Add radio buttons for "Morning / Evening batch". Submit and read the data shown at the bottom of the preview.type="range"<textarea><fieldset> with legendtype="date") and time (type="time")type="file" with accept=".pdf"method="post" and enctype="multipart/form-data"Module 6: Semantic HTML & Page Structure – plan a full page like a professional.
Q1. Which attribute decides the KEY sent to the server?
name=value.Q2. Users must pick only ONE payment method. Use:
Q3. Which method should a login form use?
Everything is a <div>. The browser, Google and screen readers cannot tell what is a menu or a story.
Tag names describe the meaning: header, nav, article, footer. Same look, much smarter page.
| Tag | Meaning | How many? |
|---|---|---|
<header> | Intro area: logo, title (page or article) | Many |
<nav> | Main navigation links | One or more |
<main> | The main unique content | Only one |
<section> | A themed group with a heading | Many |
<article> | Complete on its own: blog post, news, product card | Many |
<aside> | Side content, related but not essential | Many |
<footer> | Closing info: copyright, contact | Many |
Looks plain now. In Part 3 the same HTML becomes a 2-column layout with Flexbox/Grid.
<div> = a generic block box. <span> = a generic inline box. They mean nothing on their own – you use them as hooks for CSS.<div> inside a <span>.| id | class | |
|---|---|---|
| Unique? | Only one element per page | Many elements can share it |
| Multiple per element? | No | Yes: class="notice important" |
| Used by | Links #admission, JavaScript | CSS styling (most common) |
| CSS selector | #admission | .notice |
main-menu, price-box. No spaces inside one name.| Line | Purpose |
|---|---|
| viewport | Page fits mobile screens (Module 15) |
| title | Browser tab + Google result headline |
| description | Summary under the link on Google |
| link rel="icon" | Small logo on the browser tab (favicon) |
| link rel="stylesheet" | Connects your CSS file (Part 2) |
lang on the html tagalt on every image (empty alt="" for decoration)<label><button> and <a>, not clickable divs| Common error | Fix |
|---|---|
| Element "title" not allowed in body | Move it into head |
| Unclosed element "p" | Add the closing tag |
| Duplicate ID "menu" | Each id once only; use class instead |
| An img element must have an alt | Add alt text |
| Stray end tag "div" | Remove the extra closing tag |
Typical beginner mistakes (illustrative mix)
<article> about Netarhat with an image. Add an <aside> with "Popular Posts". Add a meta description in the head.<header> with blog name and <nav><main> with two <article> posts (heading, date, text)<footer> with "Posted by Neha"<aside> with categories list<footer> with copyrightalt="" so screen readers do not repeat it.<header><nav> with a <ul> of links<main>, each div.news → <article><aside>, div#footer → <footer>lang="en" and UTF-8Part 2: CSS Foundations – colours, fonts, boxes and selectors to make your pages beautiful.
Q1. How many <main> elements should a page have?
Q2. Which is an INLINE element?
Q3. Many elements need the same style. Use:
You have finished Part 1 of the Complete HTML + CSS Course.
Keep all your practice files in D:\my-website. You will reuse them in the capstone projects.