CSS 速用表


A

align-contentstretch|center|flex-start|flex-end|space-between|space-around
align-itemsstretch|center|flex-start|flex-end|baseline
align-selfauto|stretch|center|flex-start|flex-end|baseline
allinitial
animationname duration timing-function delay iteration-count direction fill-mode play-state
animation-delaytime
animation-directionnormal|reverse|alternate|alternate-reverse
animation-durationtime
animation-fill-modenone|forwards|backwards|both
animation-iteration-countnumber|infinite
animation-namekeyframename|none
animation-play-statepaused|running
animation-timing-functionlinear|ease|ease-in|ease-out|ease-in-out|step-start|step-end|steps(int,start|end)|cubic-bezier(n,n,n,n)

B

backface-visibilityvisible|hidden
backgroundbackground-color background-image background-position background-size background-repeat background-origin background-clip background-attachment
background-attachmentscroll|fixed|local
background-blend-modenormal|multiply|screen|overlay|darken|lighten|color-dodge|saturation|color|luminosity
background-clipborder-box|padding-box|content-box
background-colorcolor|transparent
background-imageurl(path)|none|conic-gradient([from angle] [at position,] color degree,color degree, ...)|linear-gradient(direction,color-stop1,color-stop2, ...)|radial-gradient(shape size at position,start-color, ...,last-color)|repeating-conic-gradient([from angle] [at position,] color degree,color degree, ...)|repeating-linear-gradient(angle or side-or-corner,color-stop1,color-stop2, ...)|repeating-radial-gradient(shape size at position,start-color, ...,last-color)
background-originpadding-box|border-box|content-box
background-positionleft top|left center|left bottom|right top|right center|right bottom|center top|center center|center bottom|% %|xpos ypos
background-repeatrepeat|repeat-x|repeat-y|no-repeat|space|round
background-sizeauto|length|cover|contain
borderborder-width border-style border-color
border-bottomborder-width border-style border-color
border-bottom-colorcolor|transparent
border-bottom-left-radiuslength|% [length|%]
border-bottom-right-radiuslength|% [length|%]
border-bottom-stylenone|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset
border-bottom-widthmedium|thin|thick|length
border-collapseseparate|collapse
border-colorcolor|transparent
border-imageborder-image-source border-image-slice border-image-width border-image-outset border-image-repeat
border-image-outsetlengthnumber
border-image-repeatstretch|repeat|round|space
border-image-slicenumber|%|fill
border-image-sourcenone|image
border-image-widthnumberlength|auto
border-leftborder-width border-style border-color
border-left-colorcolor|transparent
border-left-stylenone|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset
border-left-widthmedium|thin|thick|length
border-radius1~4|% / 1~4|%
border-rightborder-width border-style border-color
border-right-colorcolor|transparent
border-right-stylenone|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset
border-right-widthmedium|thin|thick|length
border-spacinglength
border-stylenone|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset
border-topborder-width border-style border-color
border-top-colorcolor|transparent
border-top-left-radiuslength|% [length|%]
border-top-right-radiuslength|% [length|%]
border-top-stylenone|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset
border-top-widthmedium|thin|thick|length
border-widthmedium|thin|thick|length
bottomauto|length
box-decoration-breakslice|clone
box-shadownone|h-offset v-offset blur spread color|inset
box-sizingcontent-box|border-box
break-afterauto|all|always|avoid|avoid-column|avoid-page|avoid-region|column|left|page|recto|region|right|verso
break-beforeauto|all|always|avoid|avoid-column|avoid-page|avoid-region|column|left|page|recto|region|right|verso
break-insideauto|avoid|avoid-column|avoid-page|avoid-region

C

caption-sidetop|bottom
caret-colorauto|color
@charset"encoding"
clearnone|left|right|both
clipauto|rect(top,right,bottom,left)
clip-pathclip-sourcebasic-shape|margin-box|border-box|padding-box|content-box|fill-box|stroke-box|view-box|none
colorcolor
column-countnumber|auto
column-fillbalance|auto
column-gaplength|normal
column-rulecolumn-rule-width column-rule-style column-rule-color
column-rule-colorcolor
column-rule-stylenone|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset
column-rule-widthmedium|thin|thick|length
column-spannone|all
column-widthauto|length
columnsauto|column-width column-count
contentnormal|none|counter|attr(attribute)|string|open-quote|close-quote|no-open-quote|no-close-quote|url(path)
counter-incrementnone|id
counter-resetnone|id number
cursoralias|all-scroll|auto|cell|context-menu|col-resize|copy|crosshair|default|e-resize|ew-resize|grab|grabbing|help|move|n-resize|ne-resize|nesw-resize|ns-resize|nw-resize|nwse-resize|no-drop|none|not-allowed|pointer|progress|row-resize|s-resize|se-resize|sw-resize|text|url(path)|vertical-text|w-resize|wait|zoom-in|zoom-out

D

directionltr|rtl
displayinline|block|contents|flex|grid|inline-block|inline-flex|inline-grid|inline-table|list-item|run-in|table|table-caption|table-column-group|table-header-group|table-footer-group|table-row-group|table-cell|table-column|table-row|none

E

empty-cellsshow|hide

F

filternone|blur(px)|brightness(%)|contrast(%)|drop-shadow(h-shadow,v-shadow,blur,spread,color)|grayscale(%)|hue-rotate(deg)|invert(%)|opacity(%)|saturate(%)|sepia(%)|url(path)
flexflex-grow flex-shrink flex-basis|auto
flex-basisnumber|auto
flex-directionrow|row-reverse|column|column-reverse
flex-flowflex-direction flex-wrap
flex-grownumber|auto
flex-shrinknumber|auto
flex-wrapnowrap|wrap|wrap-reverse
floatnone|left|right
fontfont-style font-variant font-weight font-size/line-height font-family|caption|icon|menu|message-box|small-caption|status-bar
@font-face{
 font-family;
 src;
 font-stretch;
 font-style;
 font-weight;
 unicode-range
}
font-familyfamily-name|Cursive|Fantasy|Monospace|Sans-serif|Serif
font-feature-settingsnormal|{1|0|on|off}
font-kerningauto|normal|none
font-sizemedium|xx-small|x-small|small|large|x-large|xx-large|smaller|larger|length
font-size-adjustnumber|none
font-stretchultra-condensed|extra-condensed|condensed|semi-condensed|normal|semi-expanded|expanded|extra-expanded|ultra-expanded
font-stylenormal|italic|oblique
font-variantnormal|small-caps
font-variant-capsnormal|small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps
font-weightnormal|bold|bolder|lighter|100~900

G

gaprow-gap column-gap
gridnone|grid-template-rows / grid-template-columnsgrid-template-areasgrid-template-rows / [grid-auto-flow] grid-auto-columns[grid-auto-flow] grid-auto-rows / grid-template-columns
grid-areagrid-row-start / grid-column-start / grid-row-end / grid-column-enditemname
grid-auto-columnsauto|fit-content(stretch)|max-content|min-content|minmax(min,max)|length
grid-auto-flowrow|column|dense|row dense|column dense
grid-auto-rowsauto|max-content|min-content|length
grid-columngrid-column-start / grid-column-end
grid-column-endauto|span ncolumn-line
grid-column-gaplength
grid-column-startauto|span ncolumn-line
grid-gapgrid-row-gap grid-column-gap
grid-rowgrid-row-start / grid-row-end
grid-row-endauto|row-line|span n
grid-row-gaplength
grid-row-startauto|row-line
grid-templatenone|grid-template-rows / grid-template-columnsgrid-template-areas
grid-template-areasnone|itemnames
grid-template-columnsnone|auto|max-content|min-content|length
grid-template-rowsnone|auto|max-content|min-content|length

H

hanging-punctuationnone|first|last|allow-end|force-end
heightauto|length
hyphensnone|manual|auto

I

image-renderingauto|smooth|high-quality|crisp-edges|pixelated
@importurl(path)string [list of media queries]
isolationauto|isolate

J

justify-contentflex-start|flex-end|center|space-between|space-around|space-evenly

K

@keyframes animationname{
 keyframes-selector{
  css-styles;
 }
}

L

leftauto|length
letter-spacingnormal|length
line-heightnormal|numberlength
list-stylelist-style-type list-style-position list-style-image
list-style-imagenone|url(path)
list-style-positioninside|outside
list-style-typedisc|armenian|circle|cjk-ideographic|decimal|decimal-leading-zero|georgian|hebrew|hiragana|hiragana-iroha|katakana|katakana-iroha|lower-alpha|lower-greek|lower-latin|lower-roman|none|square|upper-alpha|upper-greek|upper-latin|upper-roman

M

marginlength|auto|margin-top margin-right margin-bottom margin-left[margin-top and margin-bottom] [margin-right and margin-left]
margin-bottomlength|auto
margin-leftlength|auto
margin-rightlength|auto
margin-toplength|auto
mask-imagenone|image|url(path)
mask-modematch-source|luminance|alpha
mask-originborder-box|content-box|padding-box|margin-box|fill-box|stroke-box|view-box
mask-positionleft top|left center|left bottom|right top|right center|right bottom|center top|center center|center bottom|x% y%|xpos ypos
mask-repeatrepeat|repeat-x|repeat-y|space|round|no-repeat
mask-sizeauto|size|contain|cover
max-heightnone|length
max-widthnone|length
@media
 not|only
 all|print|screen|speech
 and(
  any-hover;
  any-pointer;
  aspect-ratio;
  color;
  color-gamut;
  color-index;
  grid;
  height;
  hover;
  inverted-colors;
  light-level;
  max-aspect-ratio;
  max-color;
  max-color-index;
  max-height;
  max-monochrome;
  max-resolution;
  max-width;
  min-aspect-ratio;
  min-color;
  min-color-index;
  min-height;
  min-monochrome;
  min-resolution;
  min-width;
  monochrome;
  orientation;
  overflow-block;
  overflow-inline;
  pointer;
  resolution;
  scan;
  scripting;
  update;
  width;
  and|or|not 同上
 ){
 CSS
}
min-heightlength
min-widthlength
mix-blend-modenormal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|difference|exclusion|hue|saturation|color|luminosity

O

object-fitfill|contain|cover|scale-down|none
object-positionposition
opacity0.0~1.0
ordernumber
orphansinteger
outlineoutline-width outline-style outline-color
outline-colorinvert|color
outline-offsetlength
outline-stylenone|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset
outline-widthmedium|thin|thick|length
overflowvisible|hidden|scroll|auto
overflow-wrapnormal|anywhere|break-word
overflow-xvisible|hidden|scroll|auto
overflow-yvisible|hidden|scroll|auto

P

paddinglength|auto|padding-top padding-right padding-bottom padding-left[padding-top and padding-bottom] [padding-right and padding-left]
padding-bottomlength|auto
padding-leftlength|auto
padding-rightlength|auto
padding-toplength|auto
page-break-afterauto|always|avoid|left|right
page-break-beforeauto|always|avoid|left|right
page-break-insideauto|avoid
perspectivelength|none
perspective-origin{left|center|right|length} {top|center|bottom|length}
pointer-eventsauto|none
positionstatic|absolute|fixed|relative|sticky

Q

quotesnone|string string string string

R

resizenone|both|horizontal|vertical
rightauto|length
row-gaplength|normal

S

scroll-behaviorauto|smooth

T

tab-sizenumberlength
table-layoutauto|fixed
text-alignleft|right|center|justify
text-align-lastauto|left|right|center|justify|start|end
text-decorationtext-decoration-line text-decoration-color text-decoration-style text-decoration-thickness
text-decoration-colorcolor
text-decoration-linenone|underline|overline|line-through
text-decoration-stylesolid|double|dotted|dashed|wavy
text-decoration-thicknessauto|from-font|length
text-indentlength
text-justifyauto|inter-word|inter-character|none
text-overflowclip|ellipsis|string
text-shadowh-shadow v-shadow blur-radius color|none
text-transformnone|capitalize|uppercase|lowercase
topauto|length
transformnone|matrix(n,n,n,n,n,n)|matrix3d(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n)|perspective(n)|rotate(angle)|rotate3d(x,y,z,angle)|rotateX(angle)|rotateY(angle)|rotateZ(angle)|scale(x,y)|scale3d(x,y,z)|scaleX(x)|scaleY(y)|scaleZ(z)|skew(x-angle,y-angle)|skewX(angle)|skewY(angle)|translate(x,y)|translate3d(x,y,z)|translateX(x)|translateY(y)|translateZ(z)
transform-origin{left|center|right|length|%} {top|center|bottom|length|%} length
transform-styleflat|preserve-3d
transitionproperty duration timing-function delay
transition-delaytime
transition-durationtime
transition-propertynone|all|property
transition-timing-functionlinear|ease|ease-in|ease-out|ease-in-out|step-start|step-end|steps(int,start|end)|cubic-bezier(n,n,n,n)

U

unicode-bidinormal|embed|bidi-override|isolate|isolate-override|plaintext
user-selectauto|none|text|all

V

vertical-alignbaseline|length|sub|super|top|text-top|middle|bottom|text-bottom
visibilityvisible|hidden|collapse

W

white-spacenormal|nowrap|pre|pre-line|pre-wrap
widowsinteger
widthauto|length
word-breaknormal|break-all|keep-all|break-word
word-spacingnormal|length
word-wrapnormal|break-word
writing-modehorizontal-tb|vertical-rl|vertical-lr

Z

z-indexauto|number

Selectors


Element

*
element
element element
element > element
element , element
element + element
element ~ element
:root


Child

:empty
:first-of-type
:last-of-type
:nth-of-type(value)
:nth-last-of-type(value)
:only-of-type
:first-child
:last-child
:nth-child(value)
:nth-last-child(value)
:only-child


Content

::after
::before
::first-letter
::first-line


Attribute

.class
#id
:lang(language)
[attribute]
[attribute=value]
[attribute|=value]
[attribute~=value]
[attribute^=value]
[attribute$=value]
[attribute*=value]


Link

:link
:visited
:active
:hover
:target


Input

:checked
:disabled
:enabled
:focus
:in-range
:invalid
:optional
:out-of-range
:read-only
:read-write
:required
:valid


Other

:not(selector)
::selection


以斜體字標示者,表示並非關鍵字,而是識別名稱或任意條件。


Values


Global

inherit
initial
unset


Number

0 1 2 3 4 5 6 7 8 9


Length,size

%
in
cm
mm
em
ex
pt
pc
px


Color

rgb(0~255, 0~255, 0~255)
rgba(0~255, 0~255, 0~255, 0.0~1.0)
hsl(0~360, 0~100%, 0~100%)
hsla(0~360, 0~100%, 0~100%, 0.0~1.0)
#000000~#FFFFFF
HTML COLOR NAME


Functions

calc(expression)
counter(countername, counterstyle)
max(value1, value2, ...)
min(value1, value2, ...)
var(--name, value)