CSS3 Cheat Sheet
CSS3 Cheat Sheet
CSS3 Cheat Sheet
CHEAT SHEET
CSS3 is the latest evolution of the Cascading Style Sheets
language and aims at extending CSS2.1. It brings a lot of
long-awaited novelties, like rounded corners, shadows,
gradients, transitions or animations, as well as new layouts
like multi-columns, flexible box or grid layouts. Experimental
parts are vendor-prefixed and should either be avoided in
production environments, or used with extreme caution as
both their syntax and semantics can change in the future.
BACKGROUNDS
background-position transparent
background-break
background-size
bounding-box | each-box | continuous background-color
background-repeat
color
background-attachment background-clip
transparent
background-origin length
background-clip % background-image
background-color border-box | padding-box | content-box | url
no-clip
background-origin none
background-repeat
border-box | padding-box | content-box background-size
repeat | repeat-x | repeat-y | no-repeat
background-position length
x-% y-%
x-pos y-pos
BORDER
border-color color
border-collapse
close
border-bottom collapse | separate
border-bottom-width border-bottom-color
border-color
border-style border-color
color
border-color
border-bottom-style
border-left border-image
border-style
image
border-left-width
border-left-color
[ number / %
border-style
border-color border-width
border-color
stretch | repeat | round ]
border-left-width
border-left-style
none
thin | medium | thick length
border-style
border-right-style border-right
border-right-color
border-right-width
border-style
border-color
border-style
border-top
border-right-width border-color
border-top-width
thin | medium | thick | length
border-radius
border-style
border-top-width border-radius
border-color
border-top-right-radius
thin | medium | thick | length
border-top-color border-bottom-right-radius
border-width border-bottom-left-radius
border-color
none
border-bottom-left-radius
length
BOX MODEL
height
height marquee-loop
%
auto infinite
% auto
marquee-play-count
height
max-height infinite
%
none integer
length margin-top
marquee-speed
% auto
slow | normal | fast
length
max-width
% marquee-style
none
scroll | slide | alternate
length padding
% padding-top overflow
length overflow-style
min-width
% auto | marquee-line | marquee-block
none | inherit
rotation
margin padding-top
angle
margin-top length
margin-right % rotation-point
margin-bottom
position (paired value off-set)
display
margin-left
none | inline | block | inline-block | visibility
list-item |run-in | compact | table |
margin-bottom inline-table | table-row-group | visible | hidden | collapse
table-header-group |
auto table-footer-group | table-row |
table-column-group | table-column | clear
length table-cell | table-caption | ruby |
ruby-base | ruby-text | left | right | both | none
% ruby-base-group | ruby-text-group
FONT
font-size/line-height length
font-style
font-family %
normal | italic | oblique | inherit
caption | icon | menu | message-box |
small-caption | status-bar font-weight
font-variant
normal | bold | bolder | lighter |
font-size-adjust normal | small-caps | inherit 100 | 200 | 300 | 400 | 500 | 600 |
700 | 800 | 900 | inherit
none | inherit
number
TEXT
ltr | rtl | inherit none | [ start | end | adjacent ] none | [ [ accent | dot | circle | disc | [
before | after ]?]
hanging-punctuation text-align
text-indent
none | [ start | end | end-edge ] start | end | left | right | center | justify
length
letter spacing text-align-last %
%
COLUMN
border-style length
column-gap
normal
length
color number [ length percentage relative length ] [ length percentage relative length ]
TEMPLATE LAYOUT
box-flex box-orient
tab-side
normal horizontal | verticle | inline-axis |
block-axis top | bottom | left | right
TABLE
empty-cells table-layout
cue-before url [ silent | x-soft | soft | medium | loud top | bottom | left | right
| x-loud | none | inherit ]
cue-after
number rest
cue-before % rest-before
mark-after speak
voice-duration
string none | normal | spell-out | digits |
time literal-punctuation | no-punctuation |
inherit-number
voice-pitch-range
voice-family
x-low | low | medium | high | x-high | inherit
inherit | [ <specific-voice, age, generic-voice,
number number> ]
voice-stress voice-rate
strong | moderate | none | reduced | inherit x-slow | slow | medium | fast | x-fast | inherit
%
voice-volume
voice-pitch
silent | x-soft | soft | medium | loud | x-loud |
inherit
x-low | low | medium | high | x-high | inherit
number
number
%
%
SPEECH
cue-before url [ silent | x-soft | soft | medium | loud top | bottom | left | right
| x-loud | none | inherit ]
cue-after
number rest
cue-before % rest-before
mark-after speak
voice-duration
string none | normal | spell-out | digits |
time literal-punctuation | no-punctuation |
inherit-number
voice-pitch-range
voice-family
x-low | low | medium | high | x-high | inherit
inherit | [ <specific-voice, age, generic-voice,
number number> ]
voice-stress voice-rate
strong | moderate | none | reduced | inherit x-slow | slow | medium | fast | x-fast | inherit
%
voice-volume
voice-pitch
silent | x-soft | soft | medium | loud | x-loud |
inherit
x-low | low | medium | high | x-high | inherit
number
number
%
%
LIST & MARKERS
ANIMATIONS
animation-duration
animation-delay animation-iteration-count
animation-timing-function
time inherit
animation-delay
number
animation-iteration-count animation-name
animation-direction none | IDENT animation-play-state
running | paused
animation-timing-function
TRANSITIONS
transitions-property
none | all
UI
normal | inherit | [icon | auto | crosshair | default | auto | inherit auto | inherit
window | desktop | work-space | pointer | move | e-resize | <id> [ current | root |
document | tooltip | dialog | ne-resize | nw-resize | n-resize | number <target-name> ]
button | push-button | se-resize | sw-resize | sw-resize |
hyperlink | radio-button | s-resize | w-resize | text | wait |
checkbox | menu-item | tab | help nav-up nav-left
menu | menubar |
pull-down-menu | url auto | inherit auto | inherit
pop-up-menu | list-menu | <id> [current | root | <id> [ current | root |
radio-group | <target-name> ] <target-name> ]
checkbox-group | outline-tree | icon
range | field | combo-box |
signature | password]
auto | inherit
nav-right resize
url
auto | inherit none | both | horizontal |
<id> [ current | root | vertical | inherit
<target-name> ]
PSEUDO-CLASS RELATIVE MEASUREMENT
:active an activated element ch width of the "0" glyph found in the font for the font
size used to render
:focus an element while the element has focus
em 1em = current font size of current element
:visited a visited link
ex x-height of the element's font
:hover an element when you mouse over it
gd the grid defined by 'layout-grid'
:link an unvisited link
px pixel of the viewing device
:disabled an element while the element is disabled
rem the font size of the root element
:enabled an element while the element is enabled
vh the viewport's height
:checked an element (form element control) that is checked
vw the viewport's width
:selection an element that is currently selected of highlighted
by the user vm viewport's height or width, whichever is smaller of
the two
:lang allows the author to specify a language to use in a
specified element
kHz kilo-hertz
PSEUDO-ELEMENT
Class Multiple elements of different types when you .sampleclass { text-decoration: underline; }
don't want to affect all instances of that type
Id A single element type when you don't want to #sampled { text-decoration: underline; }
affect all instances of that type
Descendant An element that is below (in the document #gallery h1 { text-decoration: underline; }
tree) another element - no matter how many
levels below
Child An element that is directly below (in the #title > p { font-weight: bold; }
document tree) another element
Adjacent Sibling All elements that share the same parent and h1 + p { font-style: italic; }
elements are in the same immediate sequence
General Sibling All elements that share the same parent and h1 ~ p { font-style: italic; }
elements are in the same sequence
(not necessarily immediate)
Attribute An element with that matches the attribute E[selected] - att whatever the value
listed E[att="val"] - att with a specific value
E[rel~="next"] - att with a value is a whitespace separated list
*[lang|="en"] - att value either being exactly "val" or beginning
with "val" immediately followed by "-"
E[att^="val"] - att value that begins with the prefix "val"
E[att$="val"] - att vale that begins with the suffix "val"
E[att*="val"] - att value contains at least one instance of the
substring "val"
OUTLINE
outline-width
3D / 2D TRANSFORM
transform-style
flat | preserve-3d
GENERATED CONTENT
normal line-stacking-strategy
baseline-shift drop-initial-before-adjust
number line-stacking-ruby
baseline | sub | super before-edge | text-before-edge |
central | middle | hanging | length line-stacking-shift
length mathematical
%
% length text-height
% line-stacking
dominant-baseline auto | font-size | text-size |
max-size
line-stacking-strategy
auto | use-script | no-change | drop-initial-value
reset-size | alphabetic | hanging | line-stacking-ruby
ideographic | mathematical | initial
vertical-align
central | middle | text-after-edge | line-stacking-shift
text-before-edge integer Baseline | sub | super | top |
text-top | middle | bottom |
text-bottom
length
%
HYPERLINK
target-name current | root | parent | new | window | tab | none above | behind | front | back
modal
target-new
string
target-position
POSITIONING
% auto %
length length
top
auto % auto
% length number
length
RUBY
auto | start | left | center | auto | start | end | none before | after | right | inline attr(x) | none
end | right | distribute-letter |
distribute-space | line-edge
PAGED MEDIA
fill | hidden | meet | slice auto auto | always | avoid | left | right auto | landscape | portrait
angle length
fit-position page-break-before
[top | center | bottom] || page auto | always | avoid | left | right windows
[left | center | right]
auto integer
length page-break-inside
% identifier
auto | avoid
orphans
integer