INSIDE THE EXAMPLE

Alice / 03

Original source files, including the existing teaching notes. Copy a file below or download the complete folder.

css/reset.css



/* CSS Reset */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-size: 100%;
  font-weight: normal;
}

css/style.css

@import url("reset.css");
@import url("variables.css");

/*
-----------------------------------------
CSS PROPERTIES & VALUES - QUICK REFERENCE
-----------------------------------------

CSS comments use /* and * / (without the space).

UNITS
px    = Pixels. Fixed CSS measurement.
%     = Percentage relative to another value,
        often the parent element.
em    = Relative to the element's font size
        (or parent's font size for font-size).
rem   = Relative to the root HTML font size.
vw    = 1% of the viewport width.
vh    = 1% of the viewport height.
ch    = Approximate width of the "0" character.

TYPOGRAPHY
font-family: Arial, sans-serif;
  Sets the typeface and fallback fonts.

font-size: 16px;
  Sets the size of the text.

font-weight: 400;
  Controls text weight.
  400 = Normal, 700 = Bold.
  Variable fonts may support values 100-900.

line-height: 1.5;
  Controls spacing between lines.
  1.5 means 1.5 times the font size.

letter-spacing: 2px;
  Controls spacing between characters.
  Negative values tighten spacing.

text-align: left;
  Aligns text: left, right, center, justify.

text-transform: uppercase;
  Changes appearance of text:
  uppercase, lowercase, capitalize, none.

COLOUR
color: #222222;
  Sets text colour.

background-color: #ffffff;
  Sets the background colour.

SPACING
margin: 20px;
  Space outside an element.

padding: 20px;
  Space inside an element.

margin-bottom: 20px;
  Adds space below an element.

WIDTH
width: 100%;
  Sets an element's width.

max-width: 800px;
  Limits how wide an element can become.

-----------------------------------------
*/


/*
03 — APPLYING VARIABLES / BASELINE BRIDGE
Numbering update: examples 01 and 02 have since been swapped at your request.
The original-number references below describe the files before that swap:
old 01 is now 02 (styled), and old 02 is now 01 (reset/reference).

The supplied example 02 has a reset and reference notes, but no typography
rules. Both originals are protected. Here we explicitly restore example 01's
basic typography and spacing, substituting variables for reusable values.
This necessary bridge is the only extra change in the colour lesson.
No grid, animation or experimental layout is introduced yet.
Try changing --font-size-h1 or --spacing-large in variables.css.
*/
body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-primary);
  font-size: var(--font-size-body);
  line-height: 1.6;
  padding: var(--spacing-large);
}
h1 {
  color: var(--color-primary);
  font-size: var(--font-size-h1);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: var(--spacing-medium);
}
h2 {
  color: var(--color-secondary);
  font-size: var(--font-size-h2);
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: var(--spacing-heading);
}
p {
  font-size: var(--font-size-body);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0px;
  max-width: 650px;
  margin-bottom: var(--spacing-medium);
}
/* A long word can wrap on a narrow screen without introducing fluid sizing. */
h1, h2, p { overflow-wrap: break-word; }

/*
WORKSHOP NAVIGATION — shared across the ten examples
These ordinary links open the neighbouring folder without JavaScript.
inline-block keeps the arrows beside the example number. Padding gives each
arrow a comfortable click area; currentColor follows this page's text colour.
The navigation stays in normal flow above the content, so it cannot cover it.
An outline makes keyboard focus visible. Unavailable directions are plain
spans, not links, so they cannot accidentally navigate or receive focus.
*/
.example-navigation {
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  margin-bottom: 20px;
}
.example-navigation a,
.example-navigation .unavailable {
  display: inline-block;
  padding: 12px;
  font-size: 20px;
  color: inherit;
  text-decoration: none;
}
.example-navigation a:hover { text-decoration: underline; }
.example-navigation a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.example-navigation .unavailable { opacity: .35; }
.example-navigation .example-number { font-size: 12px; }

css/variables.css


/*
03 — COLOUR AND CUSTOM PROPERTIES
:root selects the document root. Properties beginning -- are names we choose.
var(--color-primary) reads that named value wherever it is needed.
Changing one value here updates all its uses: try swapping pink and green.
Custom properties inherit from parents to children. They are reusable values,
not extra HTML elements. Keep sizes in pixels until the responsive lesson.
*/
:root {
  /* Brand: white reading text on black; pink and green for emphasis. */
  --color-primary: #FF1493;
  --color-secondary: #7FFF00;
  --color-background: #000000;
  --color-text: #FFFFFF;
  /* Typography: these starting sizes come from example 01. */
  --font-primary: Arial, Helvetica, sans-serif;
  --font-size-body: 16px;
  --font-size-h1: 64px;
  --font-size-h2: 32px;
  /* Spacing: shared distances make global adjustments easy. */
  --spacing-small: 10px;
  --spacing-medium: 20px;
  --spacing-large: 40px;
  --spacing-heading: 30px;
}

index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Alice's Adventures in Wonderland — Typography Workshop</title>
  <link rel="stylesheet" href="css/style.css">
</head>
<body>

<!-- Workshop links: each example still loads its own local CSS and JavaScript. -->
<nav class="example-navigation" aria-label="Workshop examples">
  <a href="../html-CSS02/index.html" aria-label="Previous example: 02" title="Previous example">←</a>
  <span class="example-number">03 / 10</span>
  <a href="../html-CSS04/index.html" aria-label="Next example: 04" title="Next example">→</a>
</nav>



<h1>Alice's Adventures in Wonderland</h1>

<h2>Down the Rabbit-Hole</h2>

<p>
  Alice was beginning to get very tired of sitting by her
  sister on the bank, and of having nothing to do: once or
  twice she had peeped into the book her sister was reading,
  but it had no pictures or conversations in it, "and what
  is the use of a book," thought Alice "without pictures
  or conversations?"
</p>

<p>
  So she was considering in her own mind (as well as she
  could, for the hot day made her feel very sleepy and
  stupid), whether the pleasure of making a daisy-chain
  would be worth the trouble of getting up and picking
  the daisies, when suddenly a White Rabbit with pink
  eyes ran close by her.
</p>

<p>
  There was nothing so very remarkable in that; nor did
  Alice think it so very much out of the way to hear the
  Rabbit say to itself, "Oh dear! Oh dear! I shall be late!"
  (when she thought it over afterwards, it occurred to her
  that she ought to have wondered at this, but at the time
  it all seemed quite natural); but when the Rabbit actually
  took a watch out of its waistcoat-pocket, and looked at
  it, and then hurried on, Alice started to her feet.
</p>


</body>
</html>