Today the makeover is completed
The full stylesheet — poshtik-campus/ leaves Unit 1 finished.
Lab 1 built the three pages. Lab 2 grew menu.html until it carried a real order form, then committed and pushed it. Those pages are still plain — no stylesheet, no photos, the dishes a bare list of names.
Today, picking up exactly where Lab 2 left off, you finish the job with your own hands: give all three pages their semantic skeletons, turn the dish list into ten photo cards, start style.css, style the nav, style the menu and its order form, verify every fix on your crack log, and push the commit that closes Unit 1. Same folder. Same repo. No fresh start — ever.
“Apply CSS to the Static Web Site.”
Walk out of this lab able to…
Your input is your own poshtik-campus/ folder — exactly where Lab 2 left it: three pages, menu.html carrying the order form, and the commits "First version of Poshtik Campus site" (Lab 1's exit) and "Add order form to menu" (Lab 2's exit) — plus your crack log on paper. No style.css and no images/ yet: Part 5 adds both. If your folder is behind — missed a session, machine changed — the catch-up ladder is strict, in this order: (1) if you ever pushed, git clone your own repo — your real work beats any handout; (2) if only Lab 2's order form is missing, rebuild it from Lab 2's solution sheet before Part 5; (3) only for a genuine emergency — machine died with no push, or an excused absence — the Lab-3 rescue pack below restores Lab 2's three finished pages, the logo and all ten dish photos — you still type Parts 4 and 5 yourself. Ask your instructor before using it, and read its README first.
How to use the pack — five steps, zero guessing: ① press the ZIP button below and unzip it anywhere; ② copy everything inside the unzipped poshtik-campus-rescue\ folder into a new folder Desktop\poshtik-campus\ — keep the images\ folder inside it as-is; ③ check the images\ folder holds the logo and ten dish photos; ④ open menu.html in the browser — a plain page: the ten dishes as a list, the "Order Here" form, then the Home / About us links; ⑤ run the three git commands printed in README-FIRST.txt (one honest "caught up here" commit). The pack restores files, not skills — the sessions you missed still owe you their practice, in Learning Mode, this week.
Prefer single files? README-FIRST.txt · index.html · menu.html · about.html · logo — the ten dish photos ship inside the ZIP.
Your folder holds exactly three pages — index.html, menu.html, about.html — and menu.html ends with the Order Here form. Run git log --oneline — the top line should read Lab 2's exit commit, "Add order form to menu" — the hand-off this lab picks up. If that's your log, you're standing exactly where this lab starts.
Write a class-selector rule: every dish card gets its mint background.
Today's build leans on one selector more than any other. Warm it up: write the rule that gives every element carrying class="dish" a mintcream background — and say out loud what the dot means.
<!-- menu.html — the file the rule has to reach --><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <link rel="stylesheet" href="style.css"> <!-- THIS is what connects the two files --></head><body> <article class="dish">Ragi Idli — ₹30</article> <article class="dish">Ragi Dosa — ₹40</article></body></html> /* style.css — the sheet every page links; those <article class="dish"> cards are the target */.dish /* the DOT reads: "anything whose class is…" */{ background-color: mintcream;}Steamed, light, ₹30
Crisp, iron-rich, ₹40
.dish selects by role, #page-header selects by identity (one only), h3 selects by species. Today's stylesheet uses all three — every time you write a selector today, name which of the three you reached for and why.
Write the @media skeleton for phones — from memory, punctuation and all.
The stylesheet's own last block, rebuilt from memory. Write the empty shell that says: "the rules inside apply only when the window is 600px or narrower." Every character carries a mark in the exam.
<!-- menu.html — without line 4 the phone LIES about its width and @media never fires --><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="style.css"></head> /* style.css — append below the last existing rule */@media (max-width: 600px){ /* phone-only rules live here */}@media — "dear browser, a condition follows." The @ makes it a rule about rules, not a selector.
(max-width: 600px) — "…true when the window is at most 600px." Parentheses required; a colon, not an equals.
{ … } — a second layer of braces. Whole rules go inside, each with braces of its own — the classic lost mark is closing the outer brace too early.
Margin vs padding — point to the difference on a real card.
Both are "space", both take pixels, and mixing them up is this project's most-logged crack. One sentence each — then look at a real card where both are switched on.
/* style.css — both spaces act on menu.html's <article class="dish"> cards *//* PADDING: space INSIDE the border — the card's own breathing room *//* MARGIN: space OUTSIDE the border — the gap it keeps from neighbours */.dish{ padding: 12px; /* text stands back from the border */ margin: 12px 0; /* cards stand back from each other */}green tint = padding (inside the seagreen border) · orange tint = margin (outside it, pushing neighbours away)
The whole .dish rule, one line at a time — see each property land.
This is the exact rule you'll write for real in Ex.2 this afternoon. Here it arrives one property per press on a live card, so you never wonder what each line did. Plain, unstyled card first — then background, then border, then padding, then rounded corners. Watch the same card change under your hands.
/* menu.html's <article class="dish"> card is already on screen, plain */.dish { background-color: mintcream; /* fill */ border: 2px solid seagreen; /* frame */ padding: 12px 14px; /* inner room */ border-radius: 8px; /* soft corners */}Steamed, light — ₹30
Before any press: a plain card, no fill, no frame — raw HTML. Each press adds exactly the property on that code line. Press Back to peel a property off again.
class="dish": write it once, style them all.Two questions, answered by you first. Then the sheet.
Q4. Name the three ways CSS can attach to a page, and state — with one reason — which of the three poshtik-campus/ uses for its site-wide look.
Q5. body { color: black; } and h1, h3 { color: seagreen; } both apply to a dish's <h3>. Which colour wins, and what is the one-word name of the mechanism that decides?
Both answers written? Only then.
Inline (a style= attribute — one element), internal (a <style> block in the head — one page), external (a linked .css file — the whole site). Poshtik uses external: one style.css, three pages, so a brand change is a one-file edit. The exam asks this exact classification twice today — P1·Q11a wants internal, P3·Q11b wants external.
The h3 gets seagreen. body's black arrives only by inheritance — a default handed down; h1, h3 selects the element directly, and a direct rule always beats an inherited one. The one-word mechanism: the cascade — CSS's referee. You'll write this as an exam sentence in Part 11.
- Q4 named all three and picked external with a "one file, many pages" reason — full marks. Naming two of three: revise the three ways to attach CSS tonight.
- Q5 said seagreen and the word "cascade" (or "specificity — direct beats inherited") — full marks. Guessed black? The fix is one idea: inheritance is a default, not a command.
Four tiny files, four CSS moves. Type first, then look.
Each warm-up rehearses one move today's build uses at full scale. All four live in your fswd-practice\lab-03\ sandbox — never in the repo. Answers sit right below each one, because a warm-up you can't check isn't a warm-up.
Program 1 · the class selector: in css-warmup-1.html, three list items carry class="special"-style markup: give all three dish names the brand green with one rule, using an internal <style> block.
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>CSS Warm-up 1</title> <style> .special { color: seagreen; } </style></head><body> <ul> <li class="special">Ragi Idli</li> <li>Plain Rice</li> <li class="special">Millet Shake</li> <li class="special">Pesarattu</li> </ul></body></html>- Ragi Idli
- Plain Rice
- Millet Shake
- Pesarattu
class, so the rule walks past it. The selector chose by role, not by position. One rule, any number of members.Program 2 · the id selector: in css-warmup-2.html, a page has one main heading with id="main-title". Centre it and colour it darkslategray — selecting by id.
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>CSS Warm-up 2</title> <style> #main-title /* # reads: "THE element whose id is…" */ { text-align: center; color: darkslategray; } </style></head><body> <h1 id="main-title">Poshtik Campus</h1></body></html>Poshtik Campus
#page-header.Program 3 · the box model, felt: in css-warmup-3.html, one div with a border. Add padding: 20px and watch the text step back from the wall — no layout theory, just the effect.
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>CSS Warm-up 3</title> <style> .box { border: 2px solid seagreen; padding: 20px; /* the line that changes everything */ } </style></head><body> <div class="box">Text glued to the wall — cramped.</div></body></html>BEFORE — border only:
AFTER — padding: 20px:
padding: 12px;.Program 4 · @media flips a property: in css-warmup-4.html, a paragraph reading "You are on a small screen" is hidden by default (display: none) — and a media query shows it only at 600px or less. Save, open, drag the window edge.
<!DOCTYPE html><html lang="en"><head> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- real phones need this --> <title>CSS Warm-up 4</title> <style> #phone-msg { display: none; /* default: invisible */ } @media (max-width: 600px) { #phone-msg { display: block; /* narrow window: appear */ } } </style></head><body> <p id="phone-msg">You are on a small screen</p></body></html>Poshtik Campus — welcome.
It proves the deepest fact about media queries: they run continuously, not once at load. The browser re-checks the condition on every resize. Part 12's crack-log verification leans on this — you'll drag one window edge and watch three fixes engage at once.
Open poshtik-campus. After today, this project graduates to Unit 2.
Lab 1 built the pages. Lab 2 taught them to listen. Today — the third and final lab on this project inside Unit 1 — finishes the look. The folder does not retire afterwards: Lab 4 adds script.js to this very folder and the site starts to think. No fork, no fresh start. Same repo, next unit.
File menu, Open Folder, poshtik-campus. The Explorer shows exactly three files — index.html, menu.html, about.html — your Lab-1 and Lab-2 pages. No style.css and no images/ folder yet: both arrive in Part 5.
git log --oneline in the terminal. Top line: Lab 2's "Add order form to menu". If yes — you're current. If not — Part 1's catch-up ladder, now: clone your own repo first; the rescue pack is the last rung, instructor's call.
Open all three pages in browser tabs. Today's rhythm: edit one css file, reload three tabs, watch them all obey. That is the whole argument for an external stylesheet, felt rather than recited.
Before any styling: index.html gets its semantic skeleton.
Lab 1 left index.html as a heading, a paragraph and a bare list of links — honest work for a first page, but it does not name its parts. Today's opening move re-homes that content into <header>, <nav>, <main> and <footer>, adds the logo, and links the stylesheet. The payoff lands in Part 5: the moment style.css exists, rules that say #page-header, nav a and footer p find these tags with no extra markup.
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Poshtik Campus — Home</title> <link rel="stylesheet" href="style.css"></head><body> <!-- Semantic surgery done in Lab 3 Part 4: the moment <nav> and <footer> existed, style.css's "nav a" and "footer p" rules snapped on for free. --> <header id="page-header"> <img src="images/poshtik-campus-logo.jpg" alt="Poshtik Campus logo" width="90"> <h1>Poshtik Campus</h1> <p>Healthy food, made on campus</p> </header> <nav> <a href="index.html">Home</a> <a href="menu.html">Menu</a> <a href="about.html">About</a> </nav> <main> <h2>Welcome</h2> <p>Healthy Telangana & Andhra staples at student prices — millets, sprouts and protein bowls, made fresh on campus.</p> <p>Hungry? <a href="menu.html">See today's healthy ten</a>.</p> </main> <footer> <p>Poshtik Campus · Vasavi College of Engineering</p> </footer></body></html>Healthy food, made on campus
Healthy Telangana & Andhra staples at student prices — millets, sprouts and protein bowls, made fresh on campus.
Hungry? See today's healthy ten.
Poshtik Campus · Vasavi College of Engineering
images/ does not exist yet, and no colour appears because style.css does not either. Part 5 adds both, and its #page-header, nav a and footer p rules find these named tags straight away.poshtik-campus\index.html — this file only; menu.html and about.html get the same skeleton in Part 5<head> gains the stylesheet link at line 7; the body becomes <header id="page-header"> with logo, h1 and tagline (lines 13–17), <nav> with three bare <a> links, Home now included (19–23), <main> with a Welcome heading, the welcome paragraph and a link to the menu (25–30), and <footer> (32–34)<ul>/<li> wrappers and their comment — the welcome paragraph moves into <main>, it does not leave the file</html>; the logo shows only its alt text until Part 5 creates images\ — expectedposhtik-campus — the same repo since Lab 1index.html (surgery, just done) · menu.html, about.html, images/, style.css (Part 5) · style.css grows again in Ex.1 and Ex.2fswd-practice\lab-03\ — warm-ups and all four PYQ files live here, never in the repo"Give index.html its semantic skeleton"); Part 5 adds two moregit clone https://github.com/<your-username>/poshtik-campus.git puts you exactly where everyone else stands — every lab since Lab 1 has been building this insurance.
Upgrade menu.html and about.html, add the photos, start style.css.
Four moves bring the other two pages level with index.html: a photo folder, two rebuilt pages, and the stylesheet Ex.1 and Ex.2 grow.
Move 1 · the photo folder
poshtik-campus\images\, beside the three pagesimages\ folderposhtik-campus-logo.jpg jonna-rotte-wrap.png sajja-roti-wrap.png ragi-sangati-bowl.png ragi-idli-bowl.jpg pesarattu-with-sprouts.jpg ulava-charu-protein-bowl.jpg gongura-sprouts-salad.jpg sprouts-moong-chilla.jpg paneer-protein-bowl.jpg millet-protein-shake.jpgsrc="images/…" needs these exact namesimages; index.html now shows the logoMove 2 · menu.html — ten list items become ten photo cards
The list becomes ten <article class="dish"> cards, each the same 6-line pattern (lines 30–35 is card one): only photo, name, description and price change. The order form (100–135) is unchanged, now inside <main>.
poshtik-campus\menu.html<main> with h2, cards and form (26–137), footer (139–141)<h2> and paste at line 100<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Poshtik Campus — Menu</title> <link rel="stylesheet" href="style.css"></head><!-- menu.html · Poshtik Campus menu page. The dish cards and the order form live inside <main> below. Photos come from the images folder; the look comes from style.css. --><body> <header id="page-header"> <img src="images/poshtik-campus-logo.jpg" alt="Poshtik Campus logo" width="90"> <h1>Poshtik Campus Menu</h1> <p>Healthy Food, Healthy Body, Healthy Mind</p> </header> <nav> <a href="index.html">Home</a> <a href="menu.html">Menu</a> <a href="about.html">About</a> </nav> <main> <h2>Today's Healthy Ten</h2> <article class="dish"> <img src="images/jonna-rotte-wrap.png" alt="Jonna rotte wrap filled with vegetables" width="180"> <h3>Jonna Rotte Wrap</h3> <p>Telangana sorghum-flatbread wrap, loaded with crunchy vegetables.</p> <p>Price: Rs. 60</p> </article> <article class="dish"> <img src="images/sajja-roti-wrap.png" alt="Sajja roti wrap with fresh filling" width="180"> <h3>Sajja Roti Wrap</h3> <p>Pearl-millet flatbread wrap — dense, warm, and filling.</p> <p>Price: Rs. 60</p> </article> <article class="dish"> <img src="images/ragi-sangati-bowl.png" alt="Ragi sangati bowl served hot" width="180"> <h3>Ragi Sangati Bowl</h3> <p>Classic Telangana finger-millet mudde bowl, served hot.</p> <p>Price: Rs. 55</p> </article> <article class="dish"> <img src="images/ragi-idli-bowl.jpg" alt="Bowl of soft ragi idlis" width="180"> <h3>Ragi Idli Bowl</h3> <p>Soft steamed finger-millet idlis with chutney.</p> <p>Price: Rs. 50</p> </article> <article class="dish"> <img src="images/pesarattu-with-sprouts.jpg" alt="Pesarattu dosa topped with sprouts" width="180"> <h3>Pesarattu with Sprouts</h3> <p>Andhra green-gram dosa, topped with fresh sprouts.</p> <p>Price: Rs. 55</p> </article> <article class="dish"> <img src="images/ulava-charu-protein-bowl.jpg" alt="Ulava charu protein bowl" width="180"> <h3>Ulava Charu Protein Bowl</h3> <p>Telangana horse-gram stew over a protein-rich grain bowl.</p> <p>Price: Rs. 70</p> </article> <article class="dish"> <img src="images/gongura-sprouts-salad.jpg" alt="Gongura sprouts salad" width="180"> <h3>Gongura Sprouts Salad</h3> <p>Tangy Andhra gongura leaves tossed with mixed sprouts.</p> <p>Price: Rs. 45</p> </article> <article class="dish"> <img src="images/sprouts-moong-chilla.jpg" alt="Sprouts moong chilla on a plate" width="180"> <h3>Sprouts Moong Chilla</h3> <p>Savoury moong pancake studded with sprouts.</p> <p>Price: Rs. 50</p> </article> <article class="dish"> <img src="images/paneer-protein-bowl.jpg" alt="Paneer protein bowl" width="180"> <h3>Paneer Protein Bowl</h3> <p>Grilled paneer cubes over greens and grains.</p> <p>Price: Rs. 80</p> </article> <article class="dish"> <img src="images/millet-protein-shake.jpg" alt="Glass of millet protein shake" width="180"> <h3>Millet Protein Shake</h3> <p>Cold millet-and-jaggery protein shake.</p> <p>Price: Rs. 40</p> </article> <h2>Order Here</h2> <form> <p> <label for="cust-name">Your name</label><br> <input type="text" id="cust-name" name="cust-name"> </p> <p> <label for="cust-phone">Phone number</label><br> <input type="tel" id="cust-phone" name="cust-phone"> </p> <fieldset> <legend>Pick your dish</legend> <label><input type="radio" name="dish" value="jonna-rotte-wrap"> Jonna Rotte Wrap</label><br> <label><input type="radio" name="dish" value="sajja-roti-wrap"> Sajja Roti Wrap</label><br> <label><input type="radio" name="dish" value="ragi-sangati-bowl"> Ragi Sangati Bowl</label><br> <label><input type="radio" name="dish" value="ragi-idli-bowl"> Ragi Idli Bowl</label><br> <label><input type="radio" name="dish" value="pesarattu-with-sprouts"> Pesarattu with Sprouts</label><br> <label><input type="radio" name="dish" value="ulava-charu-protein-bowl"> Ulava Charu Protein Bowl</label><br> <label><input type="radio" name="dish" value="gongura-sprouts-salad"> Gongura Sprouts Salad</label><br> <label><input type="radio" name="dish" value="sprouts-moong-chilla"> Sprouts Moong Chilla</label><br> <label><input type="radio" name="dish" value="paneer-protein-bowl"> Paneer Protein Bowl</label><br> <label><input type="radio" name="dish" value="millet-protein-shake"> Millet Protein Shake</label> </fieldset> <p> <label for="qty">Quantity</label><br> <input type="number" id="qty" name="qty" min="1" max="10" value="1"> </p> <p> <label for="notes">Notes for the kitchen</label><br> <textarea id="notes" name="notes" rows="3" cols="40"></textarea> </p> <p> <button type="submit">Place order</button> </p> </form> </main> <footer> <p>© 2026 Poshtik Campus · orders@poshtikcampus.in</p> </footer></body></html>Move 3 · about.html — the same skeleton, shorter
poshtik-campus\about.html<main> (22–25), footer (27–29)<ul> — the nav replaces it<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Poshtik Campus — About</title> <link rel="stylesheet" href="style.css"></head><body> <header id="page-header"> <img src="images/poshtik-campus-logo.jpg" alt="Poshtik Campus logo" width="90"> <h1>About us</h1> </header> <nav> <a href="index.html">Home</a> <a href="menu.html">Menu</a> <a href="about.html">About</a> </nav> <main> <p>We believe campus food can be honest food: millets, sprouts and real vegetables, cooked the way home cooks.</p> <p>Find us beside the library block, open 8am–8pm.</p> </main> <footer> <p>© 2026 Poshtik Campus · orders@poshtikcampus.in</p> </footer></body></html>git add .git commit -m "Give menu and about their semantic skeletons"Move 4 · style.css — the starting stylesheet
Every page links it at line 7. Seven base rules, then the phone @media block, which stays last.
poshtik-campus\style.css, beside index.html@media (max-width: 600px) blockimages\, and nothing below line 56's closing }/* style.css — poshtik-campus, site-wide. 81 lines at the end of Lab 3. */body{ font-family: 'Segoe UI', Arial, sans-serif; background-color: floralwhite; /* warm off-white */ color: black;}#page-header /* the banner rule — an id selector, one element only */{ background-color: darkslategray; color: white; padding: 16px; text-align: center;}h1, h3{ color: seagreen; /* the brand green */}.dish{ width: 300px; /* content width; padding + border sit outside it */ background-color: mintcream; /* pale mint */ border: 2px solid seagreen; padding: 12px; margin: 12px 0;}.dish h3{ font-size: 18px; font-weight: 600;}nav a{ color: seagreen; text-decoration: none;}footer p{ text-align: center;}/* ===== phone layout — the media query MUST stay last ============ */@media (max-width: 600px){ .dish { width: 100%; /* was 300px — now the full glass */ } form { width: 100%; /* was 480px — wider than many phones! */ } h1 { font-size: 22px; /* headline, not billboard */ }}The finished site runs as real files in Part 14 — its nav bar and form styling come from Ex.1 and Ex.2, next.
git add .git commit -m "Add site-wide stylesheet"Style the header and the nav — on all three pages at once.
The owner's brief: "the top of every page should look like one brand — dark banner, and the links under it should sit in a proper bar, not float on the background." You own every tool this needs. Build first; the gate stays shut until you've tried.
#page-header rule) but the nav links float loose on the floralwhite page. Give the nav a bar of its own — and prove the change lands on all three pages.- The
navelement gets a mintcream background, comfortable padding, and a 2px solid seagreen bottom edge. - The links spread out: 18px of space after each one (extend the existing
nav arule's work — write a secondnav arule and let the cascade merge them). - Placement rule: new base rules go above the
@mediablock — the phone overrides must stay last in the file. - Reload all three tabs — one edit, three navs.
Typed, saved, reloaded all three tabs? Only then.
style.css grows in the middle — lines 41 to 51.
Not appended at the bottom this time: the @media block keeps its seat as the last thing in the file, so base rules stay above their phone overrides. The block slides down to lines 52–67 — same 16 lines, new address.
poshtik-campus\style.css — the one file, no other file is touched in Ex.1} of the footer p rule, the last base rule. Directly below it sits the @media block's comment linefooter p { … }, before the @media comment@media block — phone overrides must stay the last thing in the file/* the elements these rules find: every page's <nav> and the <a> links inside it (all three pages carry them since Parts 4 and 5) *//* ===== Lab 3 · Ex.1 — the nav becomes a bar ===== */nav{ background-color: mintcream; /* the brand's pale mint */ padding: 10px 16px; border-bottom: 2px solid seagreen;}nav a /* SECOND nav a rule — the cascade merges, not replaces */{ margin-right: 18px;}/* ===== phone layout … slides down, stays LAST ===== */Healthy food, made on campus — welcome.
We believe campus food can be honest food: millets, sprouts and real vegetables, cooked the way home cooks.
nav a rules now exist — and that's not a mistake.
The stylesheet's existing nav a rule (colour, no underline) and today's (margin) select the same links. The cascade merges non-conflicting properties: the links are seagreen and spaced. Only when two rules set the same property does later-wins kick in — that's Q5's referee doing its everyday job.
- The three-tab check: all three pages show the bar after one save. A page without the bar has a broken (or missing)
<link>line — or, on index.html, the nav surgery from Part 4 was skipped. - The placement check: your new rules sit above
@media. If they're below it, the file still works today — but the next phone override you write will silently lose to them. Move them now. - The merge check: links are green and spaced. Only spaced? You retyped
colorinto the new rule and mistyped the old one away — one property per job, let the cascade combine.
git add .git commit -m "Style the site navigation"Style the order form — Lab 2's work gets its brand clothes.
The dish cards already wear the brand (the existing .dish rule). The order form you built in Lab 2 still stands in browser defaults — grey, cramped, off-brand. Dress it to match the cards it sits under.
menu.html, the Lab-2 order form looks like it wandered in from another site. Make it a branded card: same family as the dishes, clearly one of us.- The
formelement becomes a card: mintcream background, 2px solid seagreen border, 16px padding, 480px wide. - Its
legend(the "Pick your dish" caption) turns seagreen and bold. - The
buttoninverts the brand: seagreen background, white text, 8px 16px padding, border removed. - Placement: above the
@mediablock, after Ex.1's rules. - Reload and shrink the window below 600px — the @media block's
form { width: 100% }override must still win on phones.
Typed, saved, and squeezed the window? Only then.
style.css · lines 52 to 65 — the file reaches 81 lines.
Inserted directly after Ex.1's rules; the @media block slides down again (now lines 66–81) and stays last. This is the final growth of style.css in Unit 1.
poshtik-campus\style.css — still the one file; menu.html is not opened in Ex.2 — its Lab-2 form has sat inside <main> since Part 5} of Ex.1's second nav a rule you just wrote. Directly below it sits the @media comment line@media comment@media braces, and never below them — these are base rules; the phone's form { width: 100% } must keep overriding yours/* the elements these rules find: menu.html's <form>, its <legend> and its <button> — the order form YOU built in Lab 2 *//* ===== Lab 3 · Ex.2 — the order form joins the brand ===== */form{ background-color: mintcream; border: 2px solid seagreen; padding: 16px; width: 480px; /* the phone override still wins below 600px */}legend{ color: seagreen; font-weight: 600;}button{ background-color: seagreen; color: white; border: none; padding: 8px 16px; }button and not a class?
This site has exactly one kind of button, so the species selector is honest. The day a second, different-looking button appears, you'll promote the rule to .order-btn — selectors should be as narrow as the design needs, and no narrower. Write that sentence in an exam and markers sit up.
- The sibling check: the form and the dish cards share mint + seagreen. If your form is styled but the cards changed too, you wrote
divsomewhere instead ofform. - The squeeze check: below 600px the form goes full-width. If it stays 480px, your new
formrule sits below the @media block — order is the whole ballgame; move it above. - The button check: solid seagreen, white text, no grey ring. A remaining ring means
border: noneis missing — browsers give buttons a border you never wrote.
git add .git commit -m "Style the menu order form"PYQ · Part 1 · Q11(a) · 4+4 marks — a form plus its CSS, in one page.
You styled a real form twenty minutes ago. The exam's favourite combination question hands you the same two jobs at once: build a small form, then style it with internal CSS — a <style> block in the head, because a one-page answer has no site to share with.
Q11(a). Create an HTML page for an insurance claim form collecting: policy number, claimant name, date of incident, and claim description. Style the form using internal CSS so that the form has a light background, a visible border, and a clearly styled submit button. [4+4M]
Ans. — the two halves named first, then the code, then deeper than the marks ↓
Name the attachment before writing it (markers look for this). "Internal CSS" = one <style> block inside <head> — right for a single self-contained page; our multi-page site used external instead. One sentence, and the marker knows you know the difference.✓ 1
Choose controls by meaning (form half, 4M): policy number takes type="text" (not number — "PN-2024/117" has letters and a slash, never arithmetic) · name takes type="text" · date of incident takes type="date" (the browser's own calendar) · description takes <textarea>. Every control gets a paired <label> and a name.✓ 3
<head> <meta charset="UTF-8"> <title>Insurance Claim</title> <style> form { background-color: lavender; border: 2px solid slateblue; padding: 16px; width: 420px; } button { background-color: slateblue; color: white; border: none; padding: 8px 16px; } </style></head><form> <p><label for="policy">Policy number</label> <input type="text" id="policy" name="policy"></p> <p><label for="claimant">Claimant name</label> <input type="text" id="claimant" name="claimant"></p> <p><label for="incident">Date of incident</label> <input type="date" id="incident" name="incident"></p> <p><label for="details">Claim description</label> <textarea id="details" name="details" rows="3"></textarea></p> <button type="submit">Submit claim</button></form>The line that separates an 8 from a 6: "Internal CSS is chosen here because the claim form is one self-contained page; a multi-page site would move these same rules unchanged into an external file — the rules don't change, only their address." Selector knowledge is assumed; attachment judgement is what this question actually grades.✓
Beyond the marks: notice type="date" earned a free calendar widget — no CSS, no JavaScript. The platform gives away entire user interfaces when you declare meaning honestly. That habit — richest built-in control first, custom work second — is a production-engineering instinct the exam quietly rewards.✚ depth
Marks anatomy: 4M for the form (controls by meaning, labels paired) · 4M for internal CSS that delivers the three asked-for looks (light background, visible border, styled button). Most lost mark in real scripts: the <style> block written in the body — it often still renders, but the marker deducts for placement. Head, always.
Type claim.html in your fswd-practice\lab-03\ sandbox. Here is its live output — the real widgets, the real behaviour, including the free calendar.
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Insurance Claim</title> <style> /* INTERNAL — the question's own word */ form { background-color: lavender; /* light background ✓ */ border: 2px solid slateblue; /* visible border ✓ */ padding: 16px; width: 420px; } button { background-color: slateblue; /* styled button ✓ */ color: white; border: none; padding: 8px 16px; } </style></head><body> <form> <p><label for="policy">Policy number</label> <input type="text" id="policy" name="policy"></p> <p><label for="claimant">Claimant name</label> <input type="text" id="claimant" name="claimant"></p> <p><label for="incident">Date of incident</label> <input type="date" id="incident" name="incident"></p> <!-- free calendar --> <p><label for="details">Claim description</label> <textarea id="details" name="details" rows="3"></textarea></p> <button type="submit">Submit claim</button> </form></body></html>type="date". Then press Submit claim: the address bar grows ?policy=PN-2024%2F117&claimant=Ravi&incident=2026-08-20&details=… — note the slash in the policy number arrives encoded, more proof it was never a number.The form half is Lab 2's muscle memory. The CSS half is Ex.2's three rules with the colours swapped (lavender/slateblue instead of mintcream/seagreen — both named colours, both honest). The only decision this question adds: which attachment. That's why it's worth 8 marks and costs you 12 minutes, not 25.
PYQ · Part 2 · Q16(a) · 4 marks — a profile page in a specified font.
A short one, and a favourite: it looks like "make a page", but the marks hide in the font-family line — spelling, quoting, and the safety net at the end of the stack.
Q16(a). Write an HTML page showing a student profile (name as a heading, roll number and branch as paragraphs) where all text renders in Verdana. Use CSS. [4M]
Ans. — one rule does the whole job ↓
"All text" is the trigger phrase: don't style the heading and paragraphs one by one — put font-family on body once, and every element inherits it. That's the same move as poshtik's style.css line 4, which fonts the entire site from one line.✓ 1
Write the stack with a safety net: font-family: Verdana, Arial, sans-serif; — asked-for font first, a close cousin second, and the generic family last so a machine missing Verdana still shows a clean sans-serif. Never quote single-word font names; quote only multi-word ones like 'Segoe UI'.✓ 1
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Student Profile</title> <style> body { font-family: Verdana, Arial, sans-serif; } </style></head><body> <h1>K. Student</h1> <p>Roll number: 23CS511</p> <p>Branch: Computer Science</p></body></html>The line that separates a 4 from a 3: "The rule sits on body because font-family is an inherited property — children use the parent's value unless they say otherwise. One rule, every element, including elements added later." Styling h1 and p separately also renders — but it misses the point being graded.✓
K. Student
Roll number: 23CS511
Branch: Computer Science
This is your stylesheet's line 4 (font-family: 'Segoe UI', Arial, sans-serif;) wearing exam clothes — same property, same stack shape, same inheritance argument. Note the difference in quoting: 'Segoe UI' needs quotes (two words), Verdana must not have them. That distinction alone has cost real students a mark.
PYQ · Part 4 · Q11(b) · 4 marks — @media can target paper, not just widths.
Everything today has been practice of known moves — except this. Your stylesheet already ends with @media (max-width: 600px): a condition about window size. The same @media can instead ask what the page is being rendered onto — a screen, or a sheet of paper. One new word: print.
Q11(b). What are media types in CSS? Write CSS so that a page's navigation bar is hidden when the page is printed, and body text prints in black on white. [4M]
Ans. — definition first, then the code ↓
Definition (1M): a media type names the output device class a rule set targets — chiefly screen (monitors and phones) and print (paper and PDF). Width queries ask "how big is the window?"; a media type asks "what am I being drawn onto?" Same @media gate, different question.✓ 1
@media print{ nav { display: none; /* paper can't click links */ } body { background-color: white; color: black; /* ink is expensive; contrast is free */ }}Why hide the nav at all (the reasoning mark): a printed page can't be clicked — a nav bar on paper is dead weight that costs ink. Print styles keep content and drop interaction. Cheap test, no printer needed: Ctrl+P shows the print rendering in the preview dialog.✓ 1
The line that separates a 4 from a 3: "Note the syntax difference: media types stand bare — @media print — while media features take parentheses — @media (max-width: 600px). The two can combine: @media print and (max-width: …)." Naming both forms shows the full map, not one memorised line.✓
Beyond the marks: poshtik-campus has a real use waiting — the canteen owner will one day print the menu as a poster. The same site, one @media print block, and menu.html becomes a printable price list with no nav and no form. One document, many renderings — that idea is the whole reason CSS was separated from HTML in the first place.✚ depth
Below is menu.html with the print block added. The two buttons switch the rendering target — exactly what your browser does when Ctrl+P opens.
/* appended at the very bottom of style.css, below the phone @media block */@media print /* the type stands bare — no parentheses */{ nav { display: none; /* paper can't click links */ } body { background-color: white; color: black; /* ink is expensive; contrast is free */ }}display: none), the background flattens to white, the text drops to black-on-white ink economy. Press SCREEN and everything returns — the HTML never changed, only the rendering target. On your own file, Ctrl+P is this button.Open poshtik-campus\style.css, press Ctrl+End to jump to the very last line (line 81, the phone @media block's closing }), press Enter to open line 82, and type the 12 print lines there — appended at the very bottom, after the phone @media block. The two gates don't overlap (one asks about width, one about paper), so their order between themselves doesn't matter, but both stay below the base rules. This block is homework, not part of today's commit — see Part 15.
PYQ · Part 3 · Q11(b) · 4 marks — "cascading", finally asked head-on.
You answered Q5 this morning with the word cascade. This question makes you define it, prove you can attach an external stylesheet, and place a logo as a background image — three small jobs, four marks.
Q11(b). Why is CSS called "Cascading" Style Sheets? Show how an external stylesheet is attached to a page, and write a rule that places a company logo as the background image of the page header. [4M]
Ans. — the word, the link, the rule ↓
"Cascading" (2M): several rules can target the same element — the browser resolves conflicts by a fixed waterfall of priority: later rules beat earlier ones at equal weight, more specific selectors beat less specific (#id > .class > element), and direct rules beat inherited defaults. Example from our own site: body says black text, h1, h3 says seagreen — headings go seagreen because the direct, later rule wins. The order of rules in the file is part of the design — which is why our @media overrides live at the bottom.✓ 2
<link rel="stylesheet" href="style.css">#page-header{ background-image: url("images/logo.jpg"); background-repeat: no-repeat; background-position: left center;}The line that separates a 4 from a 3: "<img> is for images that are content (a dish photo — the page is poorer without it); background-image is for images that are decoration (the page's meaning survives without the logo)." One sentence of judgement, the mark the memorisers miss.✓
Beyond the marks: the URL inside url("images/logo.jpg") is resolved relative to the CSS file, not the HTML page — the classic production bug when a stylesheet moves into a css/ subfolder and every background breaks. Poshtik dodges it by keeping style.css at the root, beside images/.✚ depth
The logo below is the real poshtik-campus-logo.jpg you copied into images/ in Part 5. Three lines of CSS, and the header carries the brand mark.
Healthy food, made on campus — welcome.
left center, appears once (no-repeat), and the heading text flows over the background — text over background is exactly the relationship background-image promises. Try this on your real header after class; it's not part of today's commit.Take out the paper. Every crack you logged gets verified closed — now.
Your crack log is the audit of the plain site — every visual flaw you wrote down by hand. That log was a promise: each entry will be fixed by a line you can point to. Today the stylesheet is finished — so the log gets settled, entry by entry, in your own browser.
The verification protocol — for each crack on your log:
- Read the crack aloud ("dish cards touch the window edge on my phone").
- Name the line in
style.cssthat closes it — by number. - Reload the page and confirm with your eyes; for phone cracks, drag the window edge below 600px.
- Tick it on the paper. An entry you can't tick is a real bug: fix it before Part 13's commit.
Typical logs settle like this: Times New Roman everywhere → line 4 · wall-of-white sameness → lines 5, 22 · cramped card text → line 24 · cards glued together → line 25 · underlined blue nav links → lines 34–35 · cards overflow a phone screen → line 71 (@media) · form wider than a phone → line 75 (@media).
"Every fix on this site is a rule, not an edit" — the HTML is byte-for-byte what Parts 4 and 5 left, and those parts added meaning, not looks. Presentation lives entirely in one 81-line file. That separation is Unit 1's biggest single idea, and you just verified it with a checklist.
The Unit-1 closing push — your repo's story gains its styling chapter.
You've committed five times already today (Part 4's surgery, Part 5's two, then Ex.1 and Ex.2). What remains is the check that everything is recorded, and the push that puts Unit 1's finished site on GitHub.
git status— expect nothing to commit, working tree clean; anything listed means an unsaved or uncommitted fix from Part 12.git log --oneline— read your repo's seven-commit story out loud.- Plain
git push— the branches have been linked since Lab 1.
style.css beside its latest message.student@lab-12:~/poshtik-campus$ git statusnothing to commit, working tree cleanstudent@lab-12:~/poshtik-campus$ git log --oneline8c1f4d2 Style the menu order form5b7e9a3 Style the site navigationc3e6d10 Add site-wide stylesheet9e2a6b4 Give menu and about their semantic skeletons2d4c8e1 Give index.html its semantic skeleton4f9c2b1 Add order form to menua1d3e07 First version of Poshtik Campus sitestudent@lab-12:~/poshtik-campus$ git pushTo https://github.com/you/poshtik-campus.git 4f9c2b1..8c1f4d2 main -> mainFirst version → order form → index skeleton → menu and about skeletons → stylesheet → styled nav → styled form. Seven commits, each one sentence, each a step you lived. When revision week comes, this log is your syllabus map — and when Unit 2's commits start stacking on top, the story simply continues in the same book.
Four files and a photo folder — a real website, built by you, on the record.
This is the folder three labs built. Nothing in it is scaffolding; every file earns its place, and the map below says which lab put each piece there.
| WHAT THE VISITOR SEES | WHICH FILE | BUILT / STYLED BY |
|---|---|---|
| Home page — banner, nav bar, welcome | index.html | Lab 1 · surgery + bar styled today |
| Menu — 10 dish cards, prices | menu.html | Lab 1 names · cards built in Part 5, styled by .dish |
| Order form — name to Place order | menu.html | Lab 2 · branded today (Ex.2) |
| About — the story, the team | about.html | Lab 1 · skeleton in Part 5 · styled by style.css |
| Every colour, width, font, phone layout | style.css | Part 5's 56 lines → Ex.1 + Ex.2 |
Unit 1's finished website — the real files, running, styled.
Four genuine files in a browser frame: three pages and the 81-line style.css they all link. Nothing below is drawn. The banner is darkslategray because your #page-header rule says so; the cards are mintcream inside seagreen borders because your .dish rule says so. Switch pages and the bar travels with you — one stylesheet, three pages, the dividend you were promised in Ex.1.
width: 300px for 100%, the form drops 480px for 100%, and the h1 shrinks to 22px — because narrowing the frame really does cross the max-width: 600px threshold. This is your @media block executing, not an illustration of it.Lab 4 opens Unit 2 by adding one line to menu.html: <script src="script.js"></script>. The same folder, the same repo, a fifth file — and the site starts to think: totals calculated, forms checked before submitting, dishes filtered live. Structure (HTML) → presentation (CSS) → behaviour (JavaScript): the three-layer story continues in the same place it began.
Say these out loud. Hesitation marks your revision list.
Append the @media print block from Part 10 to your real style.css, verify with Ctrl+P that the nav vanishes, and commit: "Add print stylesheet for menu".
Write P1·Q11a (the claim form, both halves) once on paper, from memory, timed at 12 minutes. Then type it and run the click test — paper first, the exam hall has no autocomplete.
Unit 2 opens with a question: "the Place order button sends data away — could the page itself react instead?" Sit with it, and bring one written sentence. JavaScript answers it in Lab 4.
Two sentences: (1) Why do the base rules sit above the @media block in style.css — what exactly goes wrong if a base rule moves below it? (2) Your site has 3 HTML pages and 1 CSS file — a client wants the brand colour changed sitewide: how many files do you edit, and which line proves it?
Across the four papers, Unit 1 reliably pays: a form-building question (Lab 2's muscle), a CSS attachment question (internal vs external — today's P1 and P3), a selector/cascade theory bite (today's P3), and a @media question (widths or print — today's P4). You now hold a worked, runnable answer to every one of them, in your own handwriting and in your own repo.
Unit 1 gave your site structure and a face. Unit 2 gives it a brain — variables, functions, events, the DOM. Same folder, same repo, one new file. Lab 4 creates script.js with your own hands.