Info
Demo 2.2
CSS is for design
Files in this demo
├─ index.html └─ style.css
The page from the last demo had all the right content, but it looked pretty plain. CSS (Cascading Style Sheets) is the language that makes a page look good.
Adding CSS to a page
In this demo, CSS lives inside a <style> element at the top of the code. We can also put our CSS inside a separate file. All demos on Demoland are a single file, though, so you’ll be seeing the <style> element a bunch.
Applying CSS to elements
Here’s how we style elements:
- 1Choose a selector to target specific elements.
- 2Define a property of the element’s design that you want to change.
- 3Give that property a value.
Property-value pairs use the formatting property: value;. Try changing some of the values in this demo and see how the preview updates!
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
›