Info
Demo 1.6
Anchor Links
An anchor link jumps to a spot on the page you’re already on, instead of loading a new one. Every table of contents on the internet works this way.
It takes two halves:
- 1A link whose
hrefstarts with#, like<a href="#cats">. - 2An element somewhere on the page with a matching
id, like<h2 id="cats">.
Click the link, the browser finds the id, and it scrolls there.
Rules for ids
An id has to be unique on the page ~ two elements with id="cats" and the browser just picks one. Stick to lowercase letters and hyphens, no spaces.
One free trick
<a href="#top"> scrolls back to the top of the page even though there’s no id="top" anywhere. Browsers special-case it.
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
›