Basic

A style as a class, never inline

A style can be written in two places. One of the places is refused by the page, and the refusal is why the class exists.

What you will see

7. The value is set as a value, not as a written line.

About 1 min of reading

Try It

Prove inline is refused

1

Write the class

printf '.hide { display: none }\n' > /tmp/s.txt; wc -l < /tmp/s.txt

Before you run it, say out loud what it will print. Then open the answer.

What it prints
1. One rule in one file is the style.
2

Attempt inline

printf 'style=display:none\n' | awk '{print ($1=="style") ? "refuse inline" : "ok"}'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
refuse inline. The refusal is the rule.
3

Set a counted value

printf 'count 7\n' | awk '{print $2}'

Before you run it, say out loud what it will print. Then open the answer.

What it prints
7. The value is set as a value, not as a written line.

Data Flow

A change to a class
1 The class is written in one file
↓
2 The class is named for the change it makes
↓
3 Inline styles are refused
↓
4 A counted value is set as a value
Why this works
Why the file is separate

A separate file is a file a reviewer reads once. A style in a script is a style nobody reads.

The one value that is data and must not be text

A number from a count. A count goes through the style file as a value, never as a written line.

Examples

The class is written once

One rule in one file. One file is what makes the style readable by a reader.

Inline is refused

The page refuses it. A refusal is a rule, and a rule is why a style that works is a style that shipped.

The class is named for what it does

The name says the change. A name that says the change is a name that survives a template change.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← Changing a page under a rule
Previous Lesson
Changing a page under a rule
Next Lesson
Storage as a keyed area
Storage as a keyed area →