MGU Computer Science Series — Web Development: HTML, CSS, and JavaScript
Back Matter — Appendices A–O
Setup · HTML · CSS · JavaScript · Accessibility · Publishing
Reference Section
§
MGU Computer Science Series  ·  Web Development: HTML, CSS, and JavaScript  ·  Library Textbook Edition

Full Textbook
Back Matter

Fifteen reference appendices, a complete glossary, selected answers, and a full index — a lasting reference companion to all thirty chapters of this textbook

■ Appendices A – O ■

■ Glossary  •  Selected Answers  •  Index ■

Reference resource — designed for use throughout the course and after it ends

About This Reference Section

A textbook is read once, chapter by chapter, in order. A reference is consulted many times, out of order, for years. This back matter exists to serve the second purpose. Every appendix that follows distills material from the thirty chapters of Web Development: HTML, CSS, and JavaScript into a compact, lookup-friendly form — so that long after you have finished the course, you can still find the right selector, the right element, the right debugging question, or the right term in seconds.

The appendices are organized to mirror the structure of the book itself: project setup, HTML, CSS, JavaScript, tools and quality, and finally a glossary, selected answers, and an index. None of this material is new. It is the same content taught in the chapters, reorganized for speed of reference rather than for sequential learning.

How to Use This Back Matter

If you remember roughly what you are looking for — a CSS property, an HTML element, a JavaScript method — start with the relevant lettered appendix. If you remember only a word but not where it belongs, start with the Glossary (Appendix M) or the Index (Appendix O), which will point you back to the right chapter. If you are reviewing for an assessment, the Selected Answers (Appendix N) show what a complete answer looks like for a representative question from each part of the book.

15Appendices
90+Glossary Terms
18Sample Answers
30Chapters Indexed

Appendices at a Glance

Appendices A – C
Project Foundations: Setup, HTML, and Accessibility
File Organization · Markup · Semantic Structure

Web Project Setup Reference

Every website begins as a folder on a computer. This appendix summarizes how that folder should be organized, named, and linked together — the practical habits taught in Chapters 3, 4, and 26.

Reference
Project Folders
A single top-level folder holds the entire website. Everything the site needs — pages, styles, scripts, images, data — lives inside it, never scattered across unrelated locations.
Reference
File Extensions
.html for pages, .css for stylesheets, .js for scripts, .json for data, plus image extensions such as .png, .jpg, and .svg. The browser and editor both rely on the extension to know how to treat a file.
Reference
The Role of index.html
Web servers load a file named index.html automatically when a folder is requested without a specific filename. It should always be the homepage of a site or section.
Reference
CSS, JavaScript, Image, and Data Folders
Conventional names keep multi-file projects predictable: css/ for stylesheets, js/ for scripts, images/ for media, data/ for JSON files.
Reference
Relative Paths
A path written from the location of the current file, such as css/main.css or ../images/logo.png. Relative paths keep a project portable because they do not depend on where the project sits on a drive or server.
Reference
Absolute Paths
A path that starts from the root of the site (/css/main.css) or includes a full web address (https://example.com/css/main.css). Useful for linking to other domains or for site-root references.
Reference
Naming Conventions
Lowercase letters, hyphens instead of spaces, no special characters, and descriptive names — contact-form.html rather than Contact Form FINAL(2).html. Web servers are case-sensitive and space-intolerant.

Starter Project Structure

web-project/ ├── index.html ├── about.html ├── lessons.html ├── resources.html ├── contact.html ├── css/ │   └── main.css ├── js/ │   └── main.js ├── images/ │   ├── logo.png │   └── hero.jpg └── data/      └── resources.json
Common MistakeWhy It BreaksFix
Spaces in filenamesSpaces become %20 in URLs and are easy to mistype in pathsUse hyphens: my-page.html
Mixed-case filenamesMany servers are case-sensitive; Logo.png ≠ logo.pngUse all lowercase
Wrong number of ../ stepsEach ../ moves up exactly one folder; too many or too few breaks the linkCount folders carefully from the current file
Linking to a local file path (e.g. C:\Users\...)Only works on the original computerAlways use a path relative to the project folder

HTML Reference

HTML provides the structure and meaning of a page. This appendix summarizes the document skeleton and the most common elements covered in Chapters 5 through 10.

Document Skeleton

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Page Title</title> </head> <body> <!-- page content --> </body> </html>
ElementPurpose
<!DOCTYPE html>Tells the browser to render the page in standards mode
<html>The root element of every HTML document
<head>Holds metadata, the title, and links to CSS — nothing visible on the page itself
<body>Holds everything the user actually sees
<title>Sets the text shown in the browser tab and search results

Text and Semantic Elements

ElementPurpose
<h1>–<h6>Headings, in descending order of importance; never skip levels
<p>A paragraph of text
<strong> / <em>Strong importance / emphasis — both convey meaning, not just style
<br> / <hr>A line break / a thematic break between content
<header>Introductory content for a page or section
<nav>A block of primary navigation links
<main>The primary, unique content of the page (used once per page)
<section>A thematic grouping of content, usually with its own heading
<article>Self-contained content that could stand alone, such as a post or story
<aside>Content related to but separate from the main flow, such as a sidebar
<footer>Closing content for a page or section, such as copyright or contact links

Links, Images, Lists, and Tables

ElementPurpose
<a href="...">A hyperlink to another page, section, or resource
<img src="..." alt="...">An image; alt is required for accessibility
<ul> / <ol> / <li>Unordered list / ordered list / list item
<dl> / <dt> / <dd>Description list / term / description
<table> / <tr> / <th> / <td>Table / row / header cell / data cell — for tabular data only, never for layout
<figure> / <figcaption>Self-contained media with an attached caption

Forms

ElementPurpose
<form>Groups related inputs for submission
<label for="...">Names an input for sighted and assistive-technology users alike
<input type="...">A single-line field; the type attribute changes its behavior (text, email, checkbox, radio, and more)
<textarea>A multi-line text field
<select> / <option>A dropdown menu and its choices
<button>A clickable control, typically used to submit a form or trigger JavaScript

Metadata and Attributes

ItemPurpose
<meta charset="UTF-8">Declares the character encoding so text renders correctly
<meta name="viewport" ...>Tells mobile browsers how to scale the page
<meta name="description" ...>A short summary often shown in search results
<link rel="icon" ...>Sets the favicon shown in browser tabs
Global attributes (id, class, lang, title)Available on nearly every element to identify, style, or describe it
HTML Validation Checklist
Confirm before moving on from any page
  • Every opening tag has a matching closing tag, or is a recognized self-closing element.
  • Elements are nested correctly — no element closes before an element it contains.
  • Every <img> has an alt attribute.
  • Heading levels do not skip (no jump from <h2> straight to <h4>).
  • Attribute values are wrapped in quotation marks.
  • There is exactly one <main> element per page.
  • The page passes the W3C Markup Validator with no errors.

Semantic HTML and Accessibility Reference

Semantic HTML and accessibility are not separate topics from structure — they are what good structure produces. This appendix summarizes the landmark elements and accessibility habits taught across Chapters 6, 8, 9, and 29.

Landmark
main
The primary content of the page. One per page; lets assistive technology jump straight past repeated navigation.
Landmark
header
Introductory content — often a logo, site title, and primary navigation.
Landmark
nav
A block of navigational links. Reserve it for primary navigation, not every list of links.
Landmark
section
A thematic grouping of related content, ideally introduced by its own heading.
Landmark
article
Self-contained content that would still make sense if shared on its own, such as a blog post or review.
Landmark
aside
Content related to, but separate from, the surrounding content — a sidebar, pull quote, or related-links box.
Landmark
footer
Closing content — copyright, contact information, or secondary links.

Heading Order

Rule of Thumb

A page should have exactly one <h1>, and every heading after it should describe a level of the outline without skipping — an <h3> should only appear inside a section already introduced by an <h2>. Heading order builds the table of contents that screen reader users navigate by.

Alt Text, Labels, and Links

PracticeGuidance
Alt textDescribe the content or purpose of the image in a short phrase; use alt="" (empty, not omitted) for purely decorative images.
Form labelsEvery input needs a <label> connected with a matching for and id pair, or wrapped directly around the input.
Meaningful linksLink text should describe the destination ("Read the accessibility guide") rather than generic phrases ("click here").
Keyboard basicsEvery interactive element must be reachable and operable using only the Tab and Enter/Space keys, with a visible focus outline.
Common Pitfall

A <div> styled to look like a button is invisible to keyboard and screen reader users unless extra work is added to make it behave like one. Prefer a real <button> or <a> element whenever the content is genuinely clickable.

Appendices D – F
CSS Reference: Style, Layout, and Variables
Selectors · Cascade · Flexbox · Grid · Custom Properties

CSS Reference

CSS controls presentation. This appendix summarizes selectors, the cascade, and core styling properties taught in Chapters 11 through 14.

Selectors

SelectorExampleSelects
TypepEvery element of that type
Class.cardEvery element with class="card"
ID#main-navThe single element with that id
Groupingh1, h2, h3All listed elements, sharing one rule
Descendantnav aAny a nested anywhere inside a nav
Pseudo-classa:hoverAn element in a particular state, such as being hovered
Cascade, Specificity, and Inheritance

Cascade: when two rules conflict, the browser follows a defined order of precedence rather than guessing.

Specificity: ID selectors outrank class selectors, which outrank type selectors. More specific selectors win regardless of where they appear in the file.

Source order: among rules of equal specificity, the one written later in the stylesheet wins.

Inheritance: some properties (like color and font-family) pass automatically from parent to child unless overridden; others (like border and margin) do not.

Colors, Typography, Spacing, Borders

CategoryCommon Properties
Colorcolor, background-color — values as names, hex (#1a2c6b), rgb(), or hsl()
Typographyfont-family, font-size, font-weight, line-height, text-align, text-decoration
Spacingmargin (outside the box), padding (inside the box), shorthand order top/right/bottom/left
Bordersborder, border-width, border-color, border-style, border-radius

The Box Model

Layer 1
Content
The text or media itself, sized by width and height.
Layer 2
Padding
Space inside the border, between the border and the content.
Layer 3
Border
The edge of the box itself.
Layer 4
Margin
Space outside the border, separating the box from its neighbors.
box-sizing

Setting box-sizing: border-box makes width and height include padding and border, which is far easier to reason about than the default content-box behavior.

Display Values and Pseudo-Classes

Display ValueBehavior
blockTakes the full available width and starts on a new line (e.g. <div>, <p>)
inlineFlows within the surrounding text, sized only to its content (e.g. <span>, <a>)
flex / gridTurns the element into a layout container for its children (see Appendix E)
noneRemoves the element from the page entirely
:hover
Matches an element while the pointer is over it
:focus
Matches an element that currently has keyboard focus
:first-child
Matches an element that is the first child of its parent
:nth-child()
Matches elements by their numeric position among siblings

CSS Layout Reference

Flexbox, Grid, and responsive design give CSS its layout power. This appendix summarizes the material from Chapters 15 through 17.

FlexboxGrid
DimensionsOne-dimensional — a single row or columnTwo-dimensional — rows and columns together
Best forNavigation bars, button groups, simple card rowsFull page layouts, photo galleries, dashboards
Activate withdisplay: flexdisplay: grid
Core propertiesflex-direction, justify-content, align-items, gapgrid-template-columns, grid-template-rows, gap
Quick Reference
Flexbox row of equal cards
.card-row { display: flex; gap: 1rem; flex-wrap: wrap; }
Quick Reference
Grid with three flexible columns
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

Responsive Units and Media Queries

Unit / ToolUse
%Relative to the parent element's size
remRelative to the root font size — the standard choice for scalable typography and spacing
emRelative to the current element's font size
vw / vhA percentage of the viewport's width / height
max-widthLets a container shrink on small screens but never grow past a comfortable reading width
@media (max-width: 600px) { .card-row { flex-direction: column; } }
Mobile-First Thinking

Write the base styles for small screens first, then use min-width media queries to add complexity for larger screens. This keeps the simplest, most constrained layout as the default rather than an afterthought.

CSS Variables and Theme Reference

Custom properties turn a stylesheet into a maintainable design system. This appendix summarizes Chapter 18.

:root { --color-primary: #1a2c6b; --color-text: #1a1a1f; --space-sm: .5rem; --space-md: 1rem; --space-lg: 2rem; --font-heading: 'Playfair Display', serif; } .button { background: var(--color-primary); padding: var(--space-sm) var(--space-md); }
ConceptDescription
Custom propertyA reusable value, declared with two leading hyphens (--space-md) and read with var()
:rootThe conventional place to declare variables so they are available to the entire document
Color variablesCentralize a palette so a brand color can be changed in one place rather than hundreds
Spacing variablesA small fixed scale (e.g. sm, md, lg) keeps margins and padding consistent across a site
Reusable / utility classesSmall, single-purpose classes (.text-center, .mt-lg) that combine to style elements without repeating full rules
Theme preparationSwapping the values inside :root (or a [data-theme="dark"] override) changes the whole site's appearance at once
Maintaining a Stylesheet

Group related rules together, comment major sections, and prefer variables over repeated hard-coded values. A stylesheet that uses variables consistently can be restyled by changing a handful of lines.

Appendices G – I
JavaScript Reference: Behavior, Forms, and Data
DOM · Events · Validation · JSON · Fetch

JavaScript Browser Reference

JavaScript gives a page behavior. This appendix summarizes the core syntax and browser APIs from Chapters 19 through 23.

Linking and Core Syntax

<script src="js/main.js"></script>
ConstructExamplePurpose
Variablelet count = 0;A named, reassignable value
Constantconst name = "Site";A named value that cannot be reassigned
Template literal`Hello, ${name}`A string with embedded expressions
Functionfunction greet(name) { return `Hi ${name}`; }A reusable, named block of logic
Comment// a note to the readerIgnored by the browser; explains intent to humans

DOM Selection and Updates

Method / PropertyPurpose
document.querySelector('.card')Returns the first matching element
document.querySelectorAll('.card')Returns all matching elements as a list
element.textContentReads or sets an element's text
element.setAttribute(name, value)Reads or sets an HTML attribute
element.classList.add() / .remove() / .toggle()Adds, removes, or toggles a CSS class
document.createElement('div')Creates a new element in memory, ready to be inserted

Events

button.addEventListener('click', function () { message.textContent = 'Thanks for clicking!'; });
ConceptDescription
Event listenerRegisters a function to run when a specific event occurs on an element
Event objectPassed automatically into the handler; carries details such as which key or element triggered it
event.preventDefault()Stops a browser's default action, such as a form actually submitting

Arrays and Loops

const topics = ['HTML', 'CSS', 'JavaScript']; for (const topic of topics) { console.log(topic); }
ConstructPurpose
[item1, item2, ...]An ordered list of values
for...ofRepeats a block once for each item in an array
array.forEach(fn)Runs a function once for every array item
array.lengthThe number of items in an array

Forms and User Feedback Reference

This appendix summarizes form structure and JavaScript-driven validation from Chapters 9 and 24.

Element / AttributePurpose
<label for="email">Names the field for every user, including screen reader users
<input type="text|email|password|number">A single-line field whose type changes validation and keyboard behavior
<textarea>A multi-line field for longer responses
<select> / <option>A dropdown menu of fixed choices
<input type="checkbox">An independent on/off choice
<input type="radio">One choice among a group sharing the same name
requiredMarks a field that must be filled in before submission
<button type="submit">Submits the form
Accessible Feedback

Show error and success messages as visible text near the field they describe, not only as a color change, and announce them in a way assistive technology can detect (such as updating the text content of a labeled message element). Front-end validation improves the experience; it never replaces validation on the server.

JSON and Fetch Reference

JSON is the data format behind most data-driven pages. This appendix summarizes Chapter 28.

JSON Syntax

[ { "title": "HTML Basics", "level": "beginner" }, { "title": "Flexbox Layout", "level": "intermediate" } ]
ConceptDescription
ObjectA set of key/value pairs inside curly braces { }
ArrayAn ordered list of values inside square brackets [ ]
Array of objectsThe most common shape for site data — a list of records, each with the same keys
Local JSON fileA .json file stored in the project's data/ folder and loaded with fetch()

Fetching and Rendering Data

fetch('data/resources.json') .then(response => response.json()) .then(data => renderList(data)) .catch(error => showError(error));
StepPurpose
fetch(url)Requests a resource and returns a promise
.then()Runs code once the previous promise resolves successfully
.catch()Runs code if the request fails
Loading stateVisible feedback shown while data is being requested
Error stateVisible, friendly feedback shown if the request fails
Responsible Use of External Data

Always handle the case where a fetch fails — a missing file, a network error, or a malformed response should never leave the user staring at a broken or blank page.

Appendices J – L
Tools, Quality, and Publishing
Developer Tools · Debugging · Deployment · Maintenance

Developer Tools and Debugging Reference

Browser developer tools turn invisible page behavior into something you can inspect and test. This appendix summarizes Chapter 4 and the debugging habits reinforced throughout the book.

ProblemWhere to LookWhat to Check
Page looks unstyledNetwork panel / Elements panelIs the CSS file path correct? Did it load (not a 404)?
Style isn't applyingElements panel → Styles paneIs the rule crossed out (overridden) by a more specific or later rule?
Layout looks wrongElements panel → box model diagramAre margin, padding, and width what you expect?
Nothing happens on clickConsole panelIs there a red error message? Does the selector actually match an element?
Image or script missingNetwork panelIs the request showing a 404 or the wrong file?
Page breaks on phone-sized screensResponsive preview / device toolbarTest at common breakpoints (e.g. 375px, 768px, 1024px)
Broken Path Checklist
Walk through this list whenever a link, image, stylesheet, or script fails to load
  • Is the file extension included and spelled correctly?
  • Does the path's capitalization exactly match the actual filename?
  • Are there any spaces in the filename that should be hyphens?
  • Is the path relative to the correct file, with the correct number of ../ steps?
  • Does the file actually exist at that location in the project folder?
  • Has the page been saved and the browser refreshed since the last change?

Website Quality Checklist

This checklist consolidates the quality standards taught throughout the book, especially in Chapter 29. Run through it before considering any page finished.

Website Quality Checklist
Use before publishing any page
Structure and Validity
  • HTML validates with no errors.
  • Structure is clean, with consistent indentation and no leftover unused elements.
  • CSS is organized and readable, with related rules grouped together.
Layout and Responsiveness
  • The layout adapts cleanly to mobile, tablet, and desktop widths.
  • Text remains readable and unclipped at every tested width.
Accessibility
  • Headings follow a logical, unskipped order.
  • Every image has appropriate alt text.
  • Every form input has a connected label.
  • All interactive elements are usable with the keyboard alone.
  • Text and background colors meet a comfortable contrast level.
Performance and Correctness
  • Images are reasonably optimized for file size.
  • Every link and path has been tested and works.
  • The browser console shows no errors on any page.

Publishing and Maintenance Reference

A website's first publication is the beginning of its life, not the end of the project. This appendix summarizes Chapter 30.

Step
Final Project Review
Read through every page as a visitor would, checking content, links, and behavior end to end.
Step
File Cleanup
Remove unused files, test images, and leftover drafts before publishing.
Step
Hosting Basics
A host is a server that stores a site's files and makes them available to the public internet at all times.
Step
Domain Basics
A domain name is the human-readable address (such as example.com) that points to a hosted site.
Step
Version Control Basics
Tracking changes over time so earlier versions of a project can always be recovered.
Step
Backups and Updates
Keep copies of a project outside the live host, and revisit content and links periodically.
Deployment Checklist
Confirm before going live
  • All paths are relative and tested in the published environment, not just locally.
  • The site passes the Website Quality Checklist (Appendix K).
  • A backup of the project exists outside the hosting provider.
  • Basic documentation describes the project's structure for future maintenance.
  • A maintenance schedule is in place for reviewing content and links.
Appendices M – O
Reference Matter: Glossary, Answers, and Index
Vocabulary · Practice Support · Cross-Reference

Glossary

An alphabetical glossary of the core web development terms used throughout this textbook.

absolute path
A file path written from the root of a site or as a complete web address, rather than from the current file's location.
accessibility
Designing and building websites so they can be used by people with a wide range of abilities, including those using assistive technology.
alt text
A short text description attached to an image so its meaning is available to screen readers and when the image fails to load.
anchor element
The <a> element, used to create a hyperlink.
array
An ordered list of values in JavaScript or JSON, written inside square brackets.
attribute
Extra information added to an HTML tag, written as name="value" inside the opening tag.
block element
An element that takes the full available width and starts on a new line by default.
box model
The CSS model describing how content, padding, border, and margin combine to determine an element's total size and spacing.
breadcrumb
A secondary navigation trail showing a user's location within a site's hierarchy.
browser
Software that requests, interprets, and displays web pages to a user.
cascade
The process by which a browser resolves conflicting CSS rules to decide which one applies.
CSS
Cascading Style Sheets — the language used to control the visual presentation and layout of HTML.
character encoding
The system (typically UTF-8) that maps bytes to readable text characters in a document.
checkbox
A form input representing an independent on/off choice.
class (CSS)
A reusable attribute value used to apply the same style or behavior to multiple elements.
client
A program, typically a browser, that requests resources from a server.
client-server model
The arrangement in which clients send requests and servers send responses over a network.
comment
Text in code ignored by the browser, used to explain intent to human readers.
console
A developer tools panel that displays messages, errors, and the results of JavaScript commands.
custom property (CSS variable)
A named, reusable CSS value, declared with two leading hyphens and read with var().
data attribute
A custom data-* attribute used to attach extra information to an element for JavaScript to read.
deployment
The process of publishing a website's files to a live, publicly accessible server.
descendant selector
A CSS selector that matches elements nested anywhere inside another element.
developer tools
Built-in browser features for inspecting, testing, and debugging a page's HTML, CSS, and JavaScript.
DOM
Document Object Model — the browser's in-memory tree representation of an HTML page, which JavaScript can read and change.
domain name
The human-readable address, such as example.com, that points to a hosted website.
element
A single structural unit of an HTML document, made up of a tag, attributes, and content.
event
An occurrence, such as a click or a key press, that JavaScript can detect and respond to.
event listener
A JavaScript function registered to run automatically when a specific event happens on an element.
expression
A piece of JavaScript code that produces a value, such as 2 + 2 or name.length.
favicon
The small icon shown in a browser tab, bookmark list, or history for a website.
fetch()
A JavaScript function used to request a resource, such as a JSON file, over the network.
flexbox
A one-dimensional CSS layout system for arranging items in a row or column.
flex container
An element with display: flex applied, whose direct children become flex items.
flex item
A direct child of a flex container, positioned according to the container's flex rules.
font family
The typeface (or list of fallback typefaces) applied to text via the font-family property.
form
An HTML element that groups input controls so their values can be collected and submitted.
function
A named, reusable block of JavaScript logic that can be called with different inputs.
grid
A two-dimensional CSS layout system for arranging items into rows and columns at once.
grid container
An element with display: grid applied, whose direct children become grid items.
grid item
A direct child of a grid container, placed into the grid's rows and columns.
HTML
HyperText Markup Language — the language used to structure the content and meaning of web pages.
HTML validation
Checking HTML against the official specification to catch structural errors.
HTTP / HTTPS
The protocol browsers and servers use to exchange requests and responses; HTTPS adds encryption.
hyperlink
A clickable reference from one location on the web to another, created with the anchor element.
ID selector
A CSS selector that matches the single element carrying a particular id attribute.
inheritance
The way certain CSS property values pass automatically from a parent element to its children.
inline element
An element that flows within surrounding text and is sized only to its own content.
input element
A form control whose behavior, such as text entry or checkbox selection, is set by its type attribute.
internet
The global network of interconnected computers that the web, email, and other services run on top of.
JavaScript
The programming language that adds behavior and interactivity to web pages in the browser.
JSON
JavaScript Object Notation — a lightweight, text-based format for structuring data.
label
The HTML element that names a form input for all users, including assistive technology.
landmark
A semantic HTML element, such as main or nav, that marks a navigable region of a page.
layout
The arrangement and positioning of elements on a page.
link (CSS)
The <link> element used to connect an external stylesheet (or favicon) to an HTML document.
local file
A file stored on the developer's own computer, viewed in a browser without being published to a server.
loop
A JavaScript construct, such as for...of, that repeats a block of code for each item in a collection.
main axis
In Flexbox, the primary direction items are laid out along, set by flex-direction.
margin
The space outside an element's border, separating it from neighboring elements.
media query
A CSS rule that applies styles only when the browser or screen matches a given condition, such as a maximum width.
metadata
Information about a page, placed in the <head>, that is not displayed directly to users.
network
A connected collection of computing devices able to exchange data.
node (DOM)
A single point in the DOM tree, representing an element, attribute, or piece of text.
operator
A symbol in JavaScript, such as + or ===, that performs an operation on values.
padding
The space inside an element's border, between the border and its content.
parameter
A named input a function expects to receive when it is called.
path
A string describing the location of a file, either relative to another file or absolute from a root.
pseudo-class
A CSS selector suffix, such as :hover, that matches an element in a particular state.
query selector
A JavaScript method (querySelector / querySelectorAll) that finds elements using CSS selector syntax.
radio button
A form input representing one choice among a mutually exclusive group sharing the same name.
relative path
A file path written from the location of the current file, such as css/main.css.
render
The process by which a browser turns HTML, CSS, and JavaScript into the visible page.
responsive design
An approach to building layouts that adapt cleanly to different screen sizes and devices.
root element
The outermost element of a document — the <html> element for an HTML page.
script
A file or block of JavaScript code, typically connected to a page with a <script> tag.
section element
A semantic HTML element grouping related content under a shared theme.
selector
The part of a CSS rule that specifies which elements the rule applies to.
semantic HTML
Using HTML elements according to their meaning rather than their default appearance.
server
A computer that stores website files and responds to requests from clients.
specificity
The rule the browser uses to decide which of several matching CSS selectors takes precedence.
statement
A single complete instruction in JavaScript, typically ending with a semicolon.
string
A piece of text data in JavaScript, written inside quotation marks or backticks.
stylesheet
A file containing CSS rules, typically linked to one or more HTML documents.
table
An HTML structure for presenting tabular data in rows and columns.
tag
The marked-up text, such as <p> or </p>, that opens or closes an HTML element.
template literal
A JavaScript string written with backticks that can embed expressions using ${ }.
URL
Uniform Resource Locator — the address used to locate a specific resource on the web.
validation
Checking that code, or user-submitted data, meets expected rules before it is used or accepted.
variable
A named container for a value that a program can read and, depending on its declaration, reassign.
viewport
The visible area of a web page within the browser window or device screen.
web page
A single document accessible by a URL, typically written in HTML.
web server
Server software specifically configured to respond to HTTP requests with web content.
website
A collection of related web pages, typically sharing a domain, navigation, and design.
World Wide Web
A system of linked documents and applications that runs on top of the internet, accessed through browsers.

Selected Answers

The following are worked answers to one representative review question from each part of the textbook. They model the depth and structure expected of a complete answer; they are not the only acceptable wording.

Chapter 1 · Recall and Vocabulary, Q4
What is the difference between a website and a web page, and how does a browser relate to both?
A web page is a single document accessed by one URL. A website is a collection of related pages — usually sharing navigation, design, and a domain — that work together as one destination. A browser is the program that requests, interprets, and displays both: it loads one page at a time but uses shared elements like navigation to make the pages feel like a single connected site.
Chapter 7 · Understanding and Explanation, Q11
Why does the number of ../ segments in a relative link matter, and what happens if there are too many or too few?
Each ../ moves the browser up exactly one folder level from the current file before it starts resolving the rest of the path. Too few ../ segments leave the browser still inside a folder it needed to leave, so it looks for the target in the wrong place; too many move it above the project's root folder entirely, also producing the wrong location. The correct number always equals the number of folder levels between the current file and the shared ancestor folder of the target file.
Chapter 12 · Application and Analysis, representative
Two CSS rules both target a paragraph: p { color: blue; } and .intro { color: red; }, written in that order. The paragraph has class="intro". What color is the text, and why?
The text is red. A class selector is more specific than a type selector, so .intro wins regardless of which rule appears first in the file. Source order only breaks ties between selectors of equal specificity — it does not override the specificity hierarchy itself.
Chapter 15 · Design and Synthesis, representative
A row of three navigation links needs to wrap onto a second line on narrow screens, with even spacing between items. Which layout tool fits best, and what properties are needed?
Flexbox fits best because the links only need to be arranged along one dimension (a row that can wrap). The container needs display: flex, flex-wrap: wrap to allow wrapping, and gap to create even spacing without manual margins on each link.
Chapter 22 · Understanding and Explanation, representative
Explain what happens, step by step, when the line document.querySelector('.card').textContent = 'Updated'; runs.
The browser first searches the DOM tree for the first element with the class card. It then takes the text content property of that element and replaces it with the new string "Updated". The page updates immediately because the DOM is a live, in-memory representation of the page — changing it changes what the browser displays, without reloading the page.
Chapter 24 · Application and Analysis, representative
A contact form checks that an email field is filled in using JavaScript before allowing submission. Is server-side validation still necessary? Why or why not?
Yes. JavaScript validation runs in the user's browser and can be bypassed entirely — by disabling JavaScript, editing the page, or sending a request directly to the server without using the form at all. Front-end validation exists to give users immediate, friendly feedback; only validation performed on the server can be trusted to actually enforce the rule.
Chapter 28 · Understanding and Explanation, representative
Why does a data-driven page need a loading state and an error state, even when the data usually loads successfully?
A fetch() request is not instantaneous, and a page with no loading state appears broken or frozen for however long the request takes. An error state matters because network requests can fail for many reasons outside the developer's control — a missing file, a slow connection, or a server outage — and without one, a failure leaves the user looking at a blank or stuck page with no explanation.
Chapter 29 · Application and Analysis, representative
A page uses a styled <div> in place of a <button> for a "Show More" control. Identify the accessibility problem and how to fix it.
A plain <div> is not focusable by keyboard and is not announced as an interactive control to assistive technology, so keyboard and screen reader users may not know it can be activated at all. The fix is to use a real <button> element, which is focusable, operable with the keyboard, and announced correctly by default — without needing any extra accessibility code.

Index

An alphabetical index of elements, attributes, CSS properties, JavaScript methods, patterns, tools, and terms, cross-referenced to the chapters where they are introduced or used in depth.