CiTi · Computer Coding · Year One · Unit 4

AMP Page CSS Walkthrough

Student Walkthrough: build the AMP homepage design

The Goal

You are building the design of the AMP homepage. Open the finished example in another tab and keep it there while you work.

The finished AMP homepage: logo and navigation on top, a photo, a welcome box and a photo in the middle, and a three-column footer.

The live example also has a “Now booking” band at the top of its footer. This sheet leaves it out so you can focus on the three rows.

Look past the photos and you will see three rows. Each row is split into columns:

Row 1
w50logo
w50 navbar panel
Row 2
w25panel photo photo1
w50panel p40 center welcome
w25panel photo photo2
Row 3
w25Explore + footernav
w50 centerlogo + tagline
w25 rightSessions

Every box is built from small classes stacked together, like w25 panel photo photo1. One class sets the width, one gives the glass panel look, one adds the photo. That is the idea behind this whole sheet.

Where everything goes

FileHolds
includes/vars.incYour path variables. You already have it: nothing to change.
includes/header.incThe head, the stylesheet link, and all of Row 1. It includes topnav.inc.
includes/topnav.incThe navigation links. header.inc includes it.
index.htmlThe include lines and Row 2
includes/footer.incRow 3 and the closing tags
includes/footernav.incThe footer link list. footer.inc includes it.
css/style.cssEvery rule in this walkthrough

Part A: The Whole Page

Start with the rules that touch every page: the font, the text color, and the photo behind everything.

  1. Clear out your stylesheet. Open css/style.css. Save a copy of the old one if you want it, then start with an empty file.

  2. Add the page rules. Type this at the top.

/* ===== 1. The whole page ===== */ * { box-sizing: border-box; } body { margin: 0; padding: 20px; font-family: 'Lato', Arial, sans-serif; color: #eaf0e8; background-color: #08130e; background-image: linear-gradient(rgba(6, 16, 11, 0.40), rgba(6, 16, 11, 0.94)), url('/citi/coding/ampassets/wedding/Barkley-Hough2018427.jpg'); background-size: cover; background-position: center; background-attachment: fixed; } h1 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 500; }
RuleWhat it does
box-sizing: border-boxPadding and borders fit inside a box’s width. Without it, a 25% column plus 40px of padding is wider than 25%.
background-imageTwo layers, separated by a comma. The first is a see-through dark gradient. The second is the photo underneath it. The gradient darkens the photo so the text stays readable.
background-size: coverStretch the photo to fill the page without squishing it.
background-attachment: fixedThe photo stays still while the page scrolls over it.
font-familyLato for body text, Cormorant Garamond for the big heading. The fonts load from Google in header.inc (Part C).

Aimee’s photos and logo: do not copy them into your site. Every student calls them from the one shared ampassets folder, so the server keeps a single copy. The path starts with /, so it works from any page or stylesheet. Pick any photo from the Project Assets page and use its path the same way.

Part B: A 4-Column System

Remember the class stacking page: one class makes a row, and width classes decide how wide each column is. Think of the page as 4 equal columns:

ClassWidthCovers
w2525%1 of the 4 columns
w5050%2 columns
w7575%3 columns
w100100%All 4

Any set of classes that adds up to 100 makes a full row: w25 w25 w25 w25, w50 w25 w25, w75 w25. To change a layout, you change a class in the HTML. The CSS stays the same.

  1. Add the column system. Add this under your page rules in style.css.

/* ===== 2. The column system ===== */ .row { display: flex; gap: 20px; margin-bottom: 20px; } .w25 { width: 25%; } .w50 { width: 50%; } .w75 { width: 75%; } .w100 { width: 100%; }
RuleWhat it does
display: flexPuts everything inside the row side by side, left to right.
gap: 20pxSpace between the columns. 25% + 50% + 25% plus the gaps is a little over 100%, so flex shrinks each column a little to make it all fit. The sizes stay in proportion.
margin-bottom: 20pxSpace under each row, so rows do not touch.
  1. Try it on a practice page. Make practice.html in your amp folder (next to index.html) with this code. It is plain HTML, so open it straight from the server.

<!DOCTYPE html> <html> <head> <title>Column Practice</title> <link rel="stylesheet" href="css/style.css"> <style> .box { background-color: #2f5a43; padding: 20px; } </style> </head> <body> <div class="row"> <div class="w25 box">w25</div> <div class="w25 box">w25</div> <div class="w25 box">w25</div> <div class="w25 box">w25</div> </div> <div class="row"> <div class="w50 box">w50</div> <div class="w25 box">w25</div> <div class="w25 box">w25</div> </div> <div class="row"> <div class="w75 box">w75</div> <div class="w25 box">w25</div> </div> <div class="row"> <div class="w100 box">w100</div> </div> </body> </html>

You should see this:

  1. Stack and swap. In the second row, change w50 to w25 and one w25 to w50. The big box moves. You changed the layout without touching the CSS.

Write the classes for a row with one wide box on the right that covers 3 columns, and one small box on the left.

Part C: Classes to Stack

Width is one job. The AMP boxes need a few more jobs: a height, centered text, padding, and the dark glass look. Give each job its own small class, then stack the ones a box needs.

  1. Add the stacking classes. Add this under the column system.

/* ===== 3. Classes to stack ===== */ .vh20 { min-height: 20vh; } .vh60 { min-height: 60vh; } .middle { align-items: center; } .center { text-align: center; } .right { text-align: right; } .p40 { padding: 40px; } .panel { background-color: rgba(12, 27, 20, 0.84); border: 1px solid rgba(212, 185, 127, 0.24); border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5); }
ClassJobUse it on
vh20, vh60Row at least 20% or 60% of the screen height. vh means viewport height.A row
middleCenters the columns top to bottom inside a rowA row
center, rightLines up the textA column
p4040px of padding all aroundA column
panelThe see-through dark box with a thin gold border, round corners, and a shadowAnything

The colors use rgba: red, green, blue, then how see-through it is. 0.84 is 84% solid, so a little of the photo shows through. That is the glass look.

On your practice page, add panel and p40 to one box. What changed, and what stayed the same?

Part D: Row 1, the Logo and Navigation

Row 1 is a 2-column row: w50 for the logo, w50 for the navigation. All of it lives in header.inc, and the links come from topnav.inc, the same way footer.inc pulls in footernav.inc.

  1. Write topnav.inc. Make includes/topnav.inc. This is the link list for the top of the page.

<div class="navbar panel"> <a href="[pathvar]">Home</a> <a href="[pathvar]contactus/">Contact</a> <a href="[pathvar]about/">About</a> <a href="[pathvar]gallery/">Gallery</a> <a href="[pathvar]blogjournal/">Blog</a> <a href="[pathvar]members/">Login</a> </div>
  1. Write header.inc. Replace includes/header.inc with this. It opens the page, loads the fonts and your stylesheet (with ?v=[cart] so the newest CSS always loads), then builds Row 1: the logo in the first column, and topnav.inc included in the second.

<!DOCTYPE html> <html> <head> <title>Aimee Mohr Photography</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500&family=Lato:wght@300;400;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="[cssvar]style.css?v=[cart]"> </head> <body> <!-- ROW 1 --> <div class="row middle vh20"> <div class="w50"> <a href="[pathvar]"><img class="logo" src="/citi/coding/ampassets/amp-dark.png" alt="Aimee Mohr Photography"></a> </div> <div class="w50"> [include file=[incvar]topnav.inc] </div> </div>

Look at the classes: row middle vh20 is a row that centers its columns and is at least 20% of the screen tall. navbar panel gets the glass look from panel and the pill shape from navbar.

  1. Style the logo and the navigation. Add this to style.css.

/* ===== 4. Row 1: logo + navigation ===== */ .logo { display: block; width: 100%; max-width: 460px; } .navbar { display: flex; flex-wrap: wrap; justify-content: center; padding: 6px; border-radius: 999px; } .navbar a { padding: 11px 15px; border-radius: 999px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: #eaf0e8; } .navbar a:hover { background-color: rgba(212, 185, 127, 0.16); color: #d4b97f; }
RuleWhat it does
.logoThe logo is a PNG with a transparent background, so the photo shows around the letters. width: 100% with max-width: 460px lets it shrink in a small column but never grow past 460px.
.navbar display: flexFlex again, this time on the links: they sit in a line. flex-wrap: wrap lets them drop to a second line when space runs out.
border-radius: 999pxA huge radius rounds the ends into a pill. .navbar comes after .panel in the file, so its corners win over panel’s 14px.
:hoverThe look when the mouse is over a link.

Part E: Row 2, the Welcome Row

Row 2 is a 3-column row on the 4-column system: w25 + w50 + w25. The two outside boxes are photos, and the middle one holds the welcome message.

  1. Write index.html. Replace your homepage with this. The header line pulls in Row 1 at the top and the footer line pulls in Row 3 at the bottom, so only Row 2 lives in this file.

[include file=/citi/coding/2027/1/YOURINTS/amp/includes/vars.inc] [include file=[incvar]header.inc] <!-- ROW 2 --> <div class="row vh60"> <div class="w25 panel photo photo1"></div> <div class="w50 panel p40 center welcome"> <p class="eyebrow">Aimee Mohr Photography</p> <h1>Moments worth keeping</h1> <div class="divider"></div> <p class="welcome-text">Weddings, engagements, seniors, families, maternity and newborns. Natural, heartfelt photographs of the people and days that matter most to you.</p> <div> <a class="btn btn-solid" href="[pathvar]gallery/">View the Gallery</a> <a class="btn btn-outline" href="[pathvar]contactus/">Book a Session</a> </div> </div> <div class="w25 panel photo photo2"></div> </div> [include file=[incvar]footer.inc]
w25 panel photo photo11 column wide, glass border, photo fills it, which photo
w50 panel p40 center welcome2 columns wide, glass, padding, centered text, centered top to bottom
w25 panel photo photo2Same as the first box. Only the photo is different.
  1. Style Row 2. Add this to style.css. You can swap in any other photo from /citi/coding/ampassets/.

/* ===== 5. Row 2: photo, welcome, photo ===== */ .photo { background-size: cover; background-position: center; } .photo1 { background-image: url('/citi/coding/ampassets/wedding/PufferWedding2020-370.jpg'); } .photo2 { background-image: url('/citi/coding/ampassets/maternity/SalazarMaternity2019-4.jpg'); } .welcome { display: flex; flex-direction: column; justify-content: center; } .eyebrow { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: #d4b97f; } .welcome h1 { margin: 0 0 18px; font-size: 46px; line-height: 1.1; } .divider { width: 60px; height: 1px; margin: 0 auto 22px; background-color: #d4b97f; } .welcome-text { max-width: 520px; margin: 0 auto 28px; font-size: 17px; line-height: 1.75; color: #a9bbaf; } .btn { display: inline-block; margin: 6px; padding: 12px 26px; border: 1px solid #d4b97f; border-radius: 999px; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none; } .btn-solid { background-color: #d4b97f; color: #08130e; } .btn-solid:hover { background-color: #e3cb96; } .btn-outline { color: #d4b97f; } .btn-outline:hover { background-color: rgba(212, 185, 127, 0.16); }
RuleWhat it does
.photo / .photo1.photo has what both photo boxes share. .photo1 and .photo2 only pick the picture. The boxes are empty: the row’s vh60 gives them their height.
.welcomeFlex inside a column. flex-direction: column stacks the pieces top to bottom, and justify-content: center moves them to the middle of the box.
.dividerAn empty div 60px wide and 1px tall with a gold background: a short gold line. margin: 0 auto centers it.
max-width: 520pxKeeps the paragraph from stretching into one long line on a big screen.
.btn + .btn-solidStacking again. .btn is the shape both buttons share. .btn-solid fills it gold, .btn-outline leaves it see-through.
Make the welcome box w75. What else in Row 2 has to change so the row still adds up to 100?

Part F: Row 3, the Footer

Row 3 is w25 + w50 + w25 again: the same columns as Row 2, so you already know how it works. The difference is that the whole row sits inside one dark panel, with a copyright line under the columns.

  1. Write footernav.inc. Make includes/footernav.inc. This is the link list for the footer.

<ul class="links"> <li><a href="[pathvar]">Home</a></li> <li><a href="[pathvar]gallery/">Gallery</a></li> <li><a href="[pathvar]about/">About</a></li> <li><a href="[pathvar]blogjournal/">Blog</a></li> <li><a href="[pathvar]contactus/">Contact</a></li> </ul>
  1. Write footer.inc. Replace includes/footer.inc with this. It includes footernav.inc in its first column, then closes the page.

<!-- ROW 3 --> <footer class="footer panel p40"> <div class="row"> <div class="w25"> <h4>Explore</h4> [include file=[incvar]footernav.inc] </div> <div class="w50 center"> <img class="logo" src="/citi/coding/ampassets/amp-dark.png" alt="Aimee Mohr Photography"> <p>Weddings, engagements, seniors, families, maternity and newborns, photographed with heart.</p> </div> <div class="w25 right"> <h4>Sessions</h4> <ul class="links"> <li><a href="[pathvar]gallery/">Engagement</a></li> <li><a href="[pathvar]gallery/">Newborn</a></li> <li><a href="[pathvar]gallery/">Senior</a></li> <li><a href="[pathvar]gallery/">Family</a></li> <li><a href="[pathvar]gallery/">Wedding</a></li> <li><a href="[pathvar]gallery/">Maternity</a></li> </ul> </div> </div> <p class="copyright center">&copy; 2026 Aimee Mohr Photography &middot; All rights reserved</p> </footer> </body> </html>

The <footer> is the panel. The row inside it makes the 3 columns. The copyright line is outside the row, so it goes under all three instead of becoming a fourth column.

  1. Style the footer. Add this to style.css.

/* ===== 6. Row 3: the footer ===== */ .footer { margin-top: 40px; background-color: rgba(6, 16, 11, 0.9); color: #a9bbaf; } .footer h4 { margin: 0 0 14px; font-size: 13px; letter-spacing: 0.24em; text-transform: uppercase; color: #8fb89c; } .footer .logo { max-width: 240px; margin: 0 auto 14px; } .links { margin: 0; padding: 0; list-style: none; } .links li { margin-bottom: 10px; } .links a { color: #a9bbaf; text-decoration: none; } .links a:hover { color: #d4b97f; } .copyright { margin: 10px 0 0; padding-top: 18px; border-top: 1px solid rgba(143, 184, 156, 0.14); font-size: 12px; }
RuleWhat it does
.footerComes after .panel, so its darker background wins. It keeps panel’s border, corners, and shadow.
.footer .logoOnly a logo inside the footer: smaller, and centered with margin: 0 auto. The top logo is not touched.
list-style: noneRemoves the bullets. padding: 0 removes the indent.
border-topThe thin line above the copyright.

Rules to Remember

  • Widths in a row add up to 100. w25 + w50 + w25. The gap is handled for you.
  • One class, one job. Width, height, padding, and look are separate classes. Stack what a box needs.
  • Later rules win when two classes set the same thing. Keep .panel above .navbar and .footer.
  • Aimee’s photos and logo come from the shared folder. Use /citi/coding/ampassets/, never a copy in your own images folder.
  • Includes can hold includes. header.inc pulls in topnav.inc, and footer.inc pulls in footernav.inc. A page only needs the header and footer lines.
  • Keep ?v=[cart] on the stylesheet link. [cart] is a new number on every visit, so the browser always loads your newest style.css instead of an old saved copy.

Success Criteria Check-In

Exit Ticket

Why is it better to write .w25 once than to give every box its own width rule? Row 2 and Row 3 use the same column classes. Name one thing that makes them look different.