Web Dev Assignment 2 – Midterm Study Guide

Everything we used in class, nothing fancy.

HTML Essentials

Example: figure + caption
Placeholder rectangle

CSS Basics

CSS Selectors (Quick Reference)

Selector → Matches → Example
SelectorMatchesExample Rule
pAll <p> elementsp { color:#222; }
.noteAny element with class="note".note { background:#fffbe6; }
#main-titleElement with id="main-title"#main-title { font-size:28px; }
nav a<a> inside a <nav>nav a { text-decoration:none; }

Box Model Cheatsheet

Every element is a box: contentpaddingbordermargin.

Common Properties
PropertyWhat it DoesExample
paddingSpace inside the borderpadding:12px;
borderLine around the elementborder:1px solid #ddd;
marginSpace outside the bordermargin:10px;
widthContent widthwidth:300px;

Tip: We used * { box-sizing:border-box; } so width includes padding + border.

Lists

Unordered

  • Valid HTML
  • Clean structure
  • Good alt text

Ordered

  1. Create folders
  2. Write HTML
  3. Add CSS
  4. Upload & test

Definition

Semantic
Tags that describe meaning (e.g., <nav>).
Caption
Title for a table; also <figcaption> for images.

HTML Boilerplate & Head Tags

Common <head> Elements
TagPurposeExample
<meta charset="utf-8">Text encodingPrevents weird characters
<meta name="viewport">Mobile sizingwidth=device-width,initial-scale=1
<title>Tab title<title>My Page</title>
<link>CSS file<link rel="stylesheet" href="css/style.css">

Tables (structure we used in class)

Common HTML Elements
Element Use Notes
<figure> Wrap an image Pair with <figcaption>
<nav> Navigation links Use meaningful link text
<table> Tabular data Use <caption>, <thead>, <tbody>, scope
<img> Images Always include alt

Paths & Publishing

Example A (same folder)

<img src="logo.png" alt="Logo">

Example B (in img/)

<img src="img/logo.png" alt="Logo">

Example C (HTML in subfolder)

<img src="../img/logo.png" alt="Logo">

Accessibility Checklist

Alt Text: Do & Don’t

Examples
ImageGood AltAvoid
Logo alt="Sheridan College logo" alt="image123.png" or missing alt
Decorative divider alt="" (empty alt = decorative) Writing a long description for decoration
Screenshot of a page title alt="Web Dev 1 Homepage" “picture” or “screenshot”

Common Elements (Quick Lookup)

Tag → Purpose → Notes
TagPurposeNotes
<header>Top of page/sectionOften contains site title + nav
<nav>NavigationGroup of links
<main>Primary contentOne per page
<section>Topical groupingUse headings inside
<figure>Image + captionUse with <figcaption>
<table>Tabular dataUse <caption>, <thead>, <tbody>, scope
<footer>Page/section footerCopyright, links

Common Errors & Quick Fixes

Issue → Why → Fix
IssueWhyFix
Images don’t load online Wrong path / wrong case Check folder, use relative path, match file name case
CSS not applying Wrong link path <link rel="stylesheet" href="css/style.css"> (or ../css/style.css)
Weird symbols Missing charset Add <meta charset="utf-8">
Headings look odd Skipped levels Keep logical order: h1 → h2 → h3

Practice Quiz (Self-Check)

  1. Write the HTML to link a stylesheet at css/style.css.
  2. What’s the difference between padding and margin?
  3. Give a relative path from html/index.html to img/logo.png.
  4. Make a table with a caption and 2 columns: “Tag” and “Use”.
  5. When is alt="" appropriate?

Practice Before the Midterm

  1. Create a small 2-page site with a header, nav, and footer.
  2. Add one image with <figure> + <figcaption>.
  3. Make one unordered list and one ordered list.
  4. Build a table with a caption, thead, tbody, and scope on headers.
  5. Upload to your server and verify the public URL works.