Info
Demo 2.9
Styling text
Most of a website is words, so most of design is typography.
Choosing a font
font-family takes a list, and the browser uses the first one it has:
font-family: Georgia, serif;
Always end with a generic (serif, sans-serif, monospace) as a fallback. system-ui uses whatever the reader’s operating system uses, which loads instantly and always looks native.
Size and spacing
font-size~ useremso it respects the reader’s settings.line-height~ use a unitless number, like1.5. With a unit it gets inherited as a fixed value and wrecks anything with a different font size.letter-spacing~ tighten big headings slightly (-0.02em), loosen small caps.
The single most useful line
max-width: 60ch;
Long lines of text are exhausting to read. Capping your measure at around 60–75 characters does more for a page than any font ever will.
Extras worth knowing
text-wrap: balanceevens out the lines of a heading.text-transform: uppercaseshouts in CSS instead of in your HTML ~ so screen readers still read real words.text-underline-offsetandtext-decoration-thicknessturn the default underline into something you’d actually choose.
Keyboard Shortcuts
⌘ Z / ⌘ ⇧ ZCtrl Z / Ctrl ⇧ Z
Undo / redo
Tab / ⇧ TabTab / ⇧ Tab
Indent / unindent selection
⌘ ] / ⌘ [Ctrl ] / Ctrl [
Indent / unindent lines
⌘ ACtrl A
Select all
⌘ DCtrl D
Select next occurrence of selection
⌘ /Ctrl /
Comment / uncomment lines
Ctrl SpaceCtrl Space
Autocomplete
Ctrl EnterCtrl Enter
Reset layout
⌘ ⌥ [ / ⌘ ⌥ ]Ctrl ⇧ [ / Ctrl ⇧ ]
Fold / unfold block
Code
The editor didn't load — try refreshing the page. Navigation,
shortcuts and the info panel still work in the meantime.
Settings
View
Font size
14
Code
Preview
Delay
Zoom
Share
Reset
Preview
Currently previewing:
Dimensions0 × 0
Delay
Preview paused
Click to resume
Click to resume
The preview is disabled for this demo.
Use the console below.
Use the console below.
Console
›