HTML CSS Course Student Book
HTML CSS Course Student Book
Instructor: _____________________________
💡 Remember: Every HTML file must start with <!DOCTYPE html> so the browser knows to use modern
HTML5 rules.
1.4 Your Notes
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
<!DOCTYPE html>
<html lang="en">
<head>
<title>___________</title>
</head>
<body>
</body>
</html>
📝 Your Answer / Code:
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY HTML Text Elements & Semantics
2 Topics: Headings h1–h6 • Paragraphs • Emphasis & strong • Semantic HTML5
Element Purpose
<header> Top of page or section — logo, nav
<nav> Navigation links
<main> Primary content of the page
<section> A thematic grouping of content
<article> Self-contained content (blog post, news)
<aside> Related but secondary content (sidebar)
<footer> Bottom of page or section
<figure> / <figcaption> Image with caption
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY HTML Links, Images & Media
3 Topics: <a> anchor tag • Relative vs absolute URLs • <img> • Audio & video
3.2 Images
<!-- Basic image -->
<img src="[Link]" alt="Description of image">
💡 Alt Text: Always write descriptive alt text for images. Screen readers use it for accessibility, and search
engines use it for SEO. Never leave alt empty unless the image is purely decorative.
3.3 Audio & Video
<!-- Audio player -->
<audio controls>
<source src="song.mp3" type="audio/mpeg">
Your browser does not support audio.
</audio>
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
<figure>
<figcaption>___</figcaption>
</figure>
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY HTML Lists, Tables & Forms
4 Topics: ul / ol / dl • Table structure • Form elements • Input types
4.1 Lists
<!-- Unordered list (bullets) -->
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
4.2 Tables
<table>
<thead>
<tr>
<th>Name</th>
<th>Score</th>
<th>Grade</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alice</td>
<td>92</td>
<td>A</td>
</tr>
</tbody>
</table>
4.3 Forms
<form action="/submit" method="POST">
<label for="name">Full Name:</label>
<input type="text" id="name" name="name" placeholder="Your name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="age">Age:</label>
<input type="number" id="age" name="age" min="1" max="120">
<label for="country">Country:</label>
<select id="country" name="country">
<option value="sg">Singapore</option>
<option value="my">Malaysia</option>
</select>
<button type="submit">Submit</button>
</form>
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY Introduction to CSS — Selectors & Properties
5 Topics: CSS syntax • Linking CSS • Selectors • Specificity
/* Examples */
h1 {
color: navy;
font-size: 32px;
}
p {
color: #333333;
line-height: 1.6;
}
💡 Rule: Avoid !important — it breaks the cascade and makes debugging painful.
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Box Model & Spacing
6 Topics: Content / padding / border / margin • box-sizing • Width & height
.box {
width: 300px;
height: 150px;
padding: 20px; /* all sides */
padding: 10px 20px; /* top/bottom left/right */
padding: 5px 10px 15px 20px; /* top right bottom left (clockwise) */
border: 2px solid #333;
margin: 30px auto; /* top/bottom 30px, left/right auto (centers) */
box-sizing: border-box; /* width includes padding + border */
}
💡 Best Practice: Always set * { box-sizing: border-box; } at the top of your CSS file so widths behave
predictably.
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
* { box-sizing: border-box; }
.card {
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Typography & Fonts
7 Topics: font-family • font-size / weight / style • Google Fonts • Text properties
/* In CSS */
body { font-family: "Inter", sans-serif; }
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
✏ Exercise 7.2: Units Practice
1. What is 1.5rem if the root font-size is 16px? ___
2. What is 2em if the parent font-size is 20px? ___
3. Which unit is best for accessible font sizes and why? ___
4. Convert 24px to rem (base 16px): ___
📝 Your Answer / Code:
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Colors, Backgrounds & Gradients
8 Topics: Color formats • Background properties • Linear/radial gradients
8.3 Gradients
/* Linear gradient */
background: linear-gradient(135deg, #1A3C5E, #2674C4);
/* Multi-stop gradient */
background: linear-gradient(to right, #E86A1F, #FFCF77, #E86A1F);
/* Radial gradient */
background: radial-gradient(circle at center, #ffffff, #1A3C5E);
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Display, Positioning & Float
9 Topics: display values • position: static/relative/absolute/fixed/sticky • z-index • float
9.2 Position
/* static — default, normal document flow */
.box { position: static; }
💡 z-index: z-index only works on positioned elements (not static). Higher z-index = in front.
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Flexbox
10 Topics: flex container / items • justify-content • align-items • flex-wrap • order
/* Navigation bar */
nav { display:flex; justify-content:space-between; align-items:center; }
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
✏ Exercise 10.2: Flexbox Card Layout
1. Create 6 <div class="card"> elements inside a .card-grid container
2. Give .card-grid: display flex, flex-wrap wrap, gap 20px
3. Give .card: flex 1 1 250px, border, border-radius 8px, padding 16px
4. Make one card span full width using flex: 1 1 100%
📝 Your Answer / Code:
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Grid
11 Topics: grid-template-columns/rows • grid areas • fr unit • auto-fill / auto-fit
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Responsive Design & Media Queries
12 Topics: Viewport meta tag • Mobile-first • Breakpoints • Responsive images
This tag tells mobile browsers to use the device width (not desktop width) for rendering. Always include
it.
/* Base (mobile) */
.nav { flex-direction: column; }
/* Tablet (≥768px) */
@media (min-width: 768px) {
.nav { flex-direction: row; }
.grid { grid-template-columns: 1fr 1fr; }
}
/* Desktop (≥1024px) */
@media (min-width: 1024px) {
.grid { grid-template-columns: repeat(3, 1fr); }
}
/* Print */
@media print {
.no-print { display: none; }
}
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Transitions & Animations
13 Topics: transition shorthand • @keyframes • animation properties • transform
13.2 Transform
transform: translateX(50px); /* move right 50px */
transform: translateY(-20px); /* move up 20px */
transform: scale(1.1); /* 10% bigger */
transform: rotate(45deg); /* rotate clockwise */
transform: skewX(10deg); /* skew */
transform: translate(-50%, -50%); /* center trick with position:absolute */
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
.hero-text {
animation: fadeIn 0.8s ease forwards;
}
.badge {
animation: pulse 2s ease-in-out infinite;
}
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Pseudo-classes & Pseudo-elements
14 Topics: :hover :focus :nth-child • ::before ::after • content property
14.1 Pseudo-classes
/* User interaction */
a:hover { color: orange; }
a:visited { color: purple; }
input:focus { outline: 2px solid #2674C4; }
button:active { transform: scale(0.98); }
input:disabled { opacity: 0.5; cursor: not-allowed; }
/* Structural */
li:first-child { font-weight: bold; }
li:last-child { border-bottom: none; }
li:nth-child(odd) { background: #f5f5f5; }
li:nth-child(3n) { color: red; } /* every 3rd item */
p:not(.intro) { color: gray; } /* all p except .intro */
14.2 Pseudo-elements
/* ::before and ::after add decorative content */
.quote::before { content: "\201C"; font-size: 2em; color: gray; }
.quote::after { content: "\201D"; font-size: 2em; color: gray; }
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY CSS Variables & Custom Properties
15 Topics: --variable syntax • :root • var() • Dark mode with variables
/* Spacing */
--space-sm: 8px;
--space-md: 16px;
--space-lg: 32px;
/* Typography */
--font-base: "Inter", sans-serif;
--font-size-base: 16px;
--radius: 8px;
}
button {
background: var(--color-primary);
border-radius: var(--radius);
padding: var(--space-sm) var(--space-md);
font-family: var(--font-base);
}
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
✏ Exercise 15.2: Variable Fallbacks
1. What does var(--color-accent, coral) do when --color-accent is not defined? ___
2. Can CSS variables be used inside calc()? Example: ___
3. Write a variable for a shadow: --shadow: 0 4px 12px rgba(0,0,0,0.1)
4. Apply it to .card using box-shadow: var(--shadow)
📝 Your Answer / Code:
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY HTML Forms & CSS Styling Forms
16 Topics: Validation attributes • Custom checkboxes • Focus states • Accessible forms
input:focus {
border-color: var(--color-primary, #2674C4);
box-shadow: 0 0 0 3px rgba(38,116,196,0.2);
}
/* Style labels */
label { display: block; font-weight: 600; margin-bottom: 4px; }
/* Submit button */
button[type="submit"] {
background: var(--color-primary);
color: white; border: none; cursor: pointer;
padding: 12px 28px; border-radius: 6px;
font-size: 1rem; font-weight: 600;
}
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
_____________________________________________________________________________________
_______________
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY Project Day — Building a Complete Webpage
17 Topics: Plan → Build → Style → Polish • Portfolio page project
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
____________________________________________________________________________________
___________
✏ Exercise 17.1: Project Checklist
1. □ HTML file created with full semantic structure
2. □ External CSS linked and :root variables defined
3. □ Navbar is sticky and has hover effects
4. □ Hero section is full-height with a gradient background
5. □ About section uses Flexbox with image + text
6. □ Projects section uses CSS Grid with 3 cards
7. □ Contact form is fully styled with validation states
8. □ Page is tested and looks good at 375px, 768px, 1280px
📝 Your Answer / Code:
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
DAY Review, Best Practices & Next Steps
18 Topics: HTML/CSS checklist • Performance tips • Accessibility • What to learn next
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______
____________________________________________________________________________________
______