CSS reference
Use this CSS reference to browse an alphabetical index of all of the standard CSS properties, pseudo-classes, pseudo-elements, data types, functional notations and at-rules. You can also browse key CSS concepts and a list of selectors organized by type. Also included is a brief DOM-CSS / CSSOM reference.
Basic rule syntax
Style rule syntax
style-rule ::=
selectors-list {
properties-list
}
Where:
selectors-list ::=
selector[:pseudo-class] [::pseudo-element]
[, selectors-list]
properties-list ::=
[property : value] [; properties-list]
See the index of selectors, pseudo-classes, and pseudo-elements below. The syntax for each specified value depends on the data type defined for each specified property.
Style rule examples
strong {
color: red;
}
div.menu-bar li:hover > ul {
display: block;
}
For a beginner-level introduction to the syntax of selectors, see our guide on CSS Selectors. Be aware that any syntax error in a rule definition invalidates the entire rule. Invalid rules are ignored by the browser. Note that CSS rule definitions are entirely (ASCII) text-based, whereas DOM-CSS / CSSOM (the rule management system) is object-based.
At-rule syntax
As the structure of at-rules varies widely, please see At-rule to find the syntax of the specific one you want.
Index
Note: This index does not include SVG-exclusive presentation attributes, which can be used as CSS properties on SVG elements.
Note: The property names in this index do not include the JavaScript names which do differ from the CSS standard names.
-
A
abs()accent-coloracos():activeadditive-symbols (@counter-style)::after (:after)align-contentalign-itemsalign-selfalign-tracksall<an-plus-b><angle><angle-percentage>animationanimation-compositionanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-rangeanimation-range-endanimation-range-startanimation-timelineanimation-timing-function@annotation:any-linkappearanceascent-override (@font-face)asin()aspect-ratioatan()atan2()attr()
B
::backdropbackdrop-filterbackface-visibilitybackgroundbackground-attachmentbackground-blend-modebackground-clipbackground-colorbackground-imagebackground-originbackground-positionbackground-position-xbackground-position-ybackground-repeatbackground-sizebase-palette (@font-palette-values)<basic-shape>::before (:before):blankbleed (@page)<blend-mode>block-sizeblur()borderborder-blockborder-block-colorborder-block-endborder-block-end-colorborder-block-end-styleborder-block-end-widthborder-block-startborder-block-start-colorborder-block-start-styleborder-block-start-widthborder-block-styleborder-block-widthborder-bottomborder-bottom-colorborder-bottom-left-radiusborder-bottom-right-radiusborder-bottom-styleborder-bottom-widthborder-collapseborder-colorborder-end-end-radiusborder-end-start-radiusborder-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-widthborder-inlineborder-inline-colorborder-inline-endborder-inline-end-colorborder-inline-end-styleborder-inline-end-widthborder-inline-startborder-inline-start-colorborder-inline-start-styleborder-inline-start-widthborder-inline-styleborder-inline-widthborder-leftborder-left-colorborder-left-styleborder-left-widthborder-radiusborder-rightborder-right-colorborder-right-styleborder-right-widthborder-spacingborder-start-end-radiusborder-start-start-radiusborder-styleborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-styleborder-top-widthborder-widthbottom@bottom-centerbox-decoration-breakbox-shadowbox-sizingbreak-afterbreak-beforebreak-insidebrightness()
C
calc()caption-sidecaretcaret-colorcaret-shape@character-variant@charset:checkedcircle()clamp()clearclipclip-path<color>colorcolor-schemecolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcolumnsconic-gradient()containcontain-intrinsic-block-sizecontain-intrinsic-heightcontain-intrinsic-inline-sizecontain-intrinsic-sizecontain-intrinsic-widthcontainercontainer-namecontainer-typecontentcontent-visibilitycontrast()cos()<counter>counter-incrementcounter-resetcounter-set@counter-stylecounters()cross-fade()cubic-bezier()::cue::cue-region:currentcursor<custom-ident>length#caplength#chlength#cm
D
angle#deg<dashed-ident>:default:defineddescent-override (@font-face)<dimension>:dirdirection:disableddisplay<display-box><display-inside><display-internal><display-legacy><display-listitem><display-outside>drop-shadow()resolution#dpcmresolution#dpiresolution#dppx
E
F
fallback (@counter-style)filter<filter-function>:first:first-child::first-letter (:first-letter)::first-line (:first-line):first-of-typefit-content()<flex>flexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapflex_value#frfloat:focus:focus-visible:focus-withinfontfont-display (@font-face)@font-facefont-familyfont-family (@font-face)font-family (@font-palette-values)font-feature-settingsfont-feature-settings (@font-face)@font-feature-valuesfont-kerningfont-language-overridefont-optical-sizingfont-palette@font-palette-valuesfont-sizefont-size-adjustfont-stretchfont-stretch (@font-face)font-stylefont-style (@font-face)font-synthesisfont-synthesis-positionfont-synthesis-small-capsfont-synthesis-stylefont-synthesis-weightfont-variantfont-variant-alternatesfont-variant-capsfont-variant-east-asianfont-variant-emojifont-variant-ligaturesfont-variant-numericfont-variant-positionfont-variation-settingsfont-variation-settings (@font-face)font-weightfont-weight (@font-face)forced-color-adjustformat()<frequency><frequency-percentage>:fullscreen:future
G
angle#gradgap<gradient>::grammar-errorgrayscale()gridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-startgrid-rowgrid-row-endgrid-row-startgrid-templategrid-template-areasgrid-template-columnsgrid-template-rows
H
frequency#Hzhanging-punctuation:hasheight@historical-forms:host():host-context():hoverhsl()hue-rotate()hwb()hyphenate-characterhyphenate-limit-charshyphenshypot()
I
<ident><image>image()image-orientationimage-renderingimage-resolutionimage-set()@import:in-range:indeterminateinheritinherits (@property)initialinitial-letterinitial-letter-aligninitial-value (@property)inline-sizeinput-securityinsetinset()inset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-start<integer>:invalidinvert():isisolationlength#iclength#in
J
K
L
lab():lang:last-child:last-of-type@layerlayer()layer() (@import)lch()leader():leftleft@left-bottom<length><length-percentage>letter-spacinglight-dark()line-breakline-clampline-gap-override (@font-face)line-heightline-height-step<line-style>linear-gradient():linklist-stylelist-style-imagelist-style-positionlist-style-typelocal():local-linklog()
M
length#mmmarginmargin-blockmargin-block-endmargin-block-startmargin-bottommargin-inlinemargin-inline-endmargin-inline-startmargin-leftmargin-rightmargin-topmargin-trim::markermarks (@page)maskmask-bordermask-border-modemask-border-outsetmask-border-repeatmask-border-slicemask-border-sourcemask-border-widthmask-clipmask-compositemask-imagemask-modemask-originmask-positionmask-repeatmask-sizemask-typemasonry-auto-flowmath-depthmath-shiftmath-stylematrix()matrix3d()max()max-block-sizemax-heightmax-inline-sizemax-linesmax-width@mediamin()min-block-sizemin-heightmin-inline-sizemin-widthminmax()mix-blend-modemod()time#ms
N
@namespacenegative (@counter-style):not:nth-child:nth-last-child:nth-last-of-type:nth-of-type<number>
O
object-fitobject-positionoffsetoffset-anchoroffset-distanceoffset-pathoffset-positionoffset-rotate:only-child:only-of-typeopacityopacity():optionalorder@ornamentsorphans:out-of-rangeoutlineoutline-coloroutline-offsetoutline-styleoutline-width<overflow>overflow-anchoroverflow-blockoverflow-clip-marginoverflow-inlineoverflow-wrapoverflow-xoverflow-yoverlayoverride-colors (@font-palette-values)overscroll-behavioroverscroll-behavior-blockoverscroll-behavior-inlineoverscroll-behavior-xoverscroll-behavior-y
P
Pseudo-classesPseudo-elementslength#pclength#ptlength#pxpad (@counter-style)paddingpadding-blockpadding-block-endpadding-block-startpadding-bottompadding-inlinepadding-inline-endpadding-inline-startpadding-leftpadding-rightpadding-top@pagepagepage-break-afterpage-break-beforepage-break-insidepage-orientation (@page)paint()paint-order::part:pastpath():paused<percentage>perspectiveperspective()perspective-origin:picture-in-pictureplace-contentplace-itemsplace-self::placeholder:placeholder-shown:playingpointer-eventspolygon()<position>positionpow()prefix (@counter-style)print-color-adjust@property
Q
R
angle#radlength#remradial-gradient()range (@counter-style)<ratio>ray():read-only:read-writerect()rem()repeat()repeating-conic-gradient()repeating-linear-gradient()repeating-radial-gradient():requiredresize<resolution>reversed()revertrgb():rightright@right-bottom:rootrotaterotate()rotate3d()rotateX()rotateY()rotateZ()round()row-gapruby-alignruby-mergeruby-position
S
saturate()scalescale()scale3d()scaleX()scaleY()scaleZ():scope@scopescroll()scroll-behaviorscroll-marginscroll-margin-blockscroll-margin-block-endscroll-margin-block-startscroll-margin-bottomscroll-margin-inlinescroll-margin-inline-endscroll-margin-inline-startscroll-margin-leftscroll-margin-rightscroll-margin-topscroll-paddingscroll-padding-blockscroll-padding-block-endscroll-padding-block-startscroll-padding-bottomscroll-padding-inlinescroll-padding-inline-endscroll-padding-inline-startscroll-padding-leftscroll-padding-rightscroll-padding-topscroll-snap-alignscroll-snap-stopscroll-snap-typescroll-timelinescroll-timeline-axisscroll-timeline-namescrollbar-colorscrollbar-gutterscrollbar-width::selectionselector()sepia()<shape>shape-image-thresholdshape-marginshape-outsidesign()sin()size (@page)size-adjust (@font-face)skew()skewX()skewY()::slottedspeak-as (@counter-style)::spelling-errorsqrt()src (@font-face)@starting-stylesteps()<string>@styleset@stylisticsuffix (@counter-style)@supportssupports() (@import)@swashsymbols (@counter-style)symbols()syntax (@property)system (@counter-style)time#s
T
angle#turntab-sizetable-layouttan():targettarget-counter()target-counters()::target-texttarget-text():target-withintext-aligntext-align-lasttext-combine-uprighttext-decorationtext-decoration-colortext-decoration-linetext-decoration-skiptext-decoration-skip-inktext-decoration-styletext-decoration-thicknesstext-emphasistext-emphasis-colortext-emphasis-positiontext-emphasis-styletext-indenttext-justifytext-orientationtext-overflowtext-renderingtext-shadowtext-size-adjusttext-transformtext-underline-offsettext-underline-positiontext-wraptext-wrap-modetext-wrap-style<time><time-percentage>timeline-scopetop@top-centertouch-actiontransformtransform-box<transform-function>transform-origintransform-styletransitiontransition-behaviortransition-delaytransition-durationtransition-propertytransition-timing-functiontranslatetranslate()translate3d()translateX()translateY()translateZ()type()
U
V
length#vhlength#vmaxlength#vminlength#vw:validvar()vertical-alignview()view-timelineview-timeline-axisview-timeline-insetview-timeline-name::view-transition::view-transition-group::view-transition-image-pairview-transition-name::view-transition-new::view-transition-oldvisibility:visited
W
:wherewhite-spacewhite-space-collapsewidowswidthwill-changeword-breakword-spacingword-wrapwriting-mode
X
Z
Others
Selectors
The following are the various selectors, which allow styles to be conditional based on various features of elements within the DOM.
Basic selectors
Basic selectors are fundamental selectors; these are the most basic selectors that are frequently combined to create other, more complex selectors.
- Universal selector
* - Type selector
elementname - Class selector
.classname - ID selector
#idname - Attribute selector
[attr=value]
Grouping selectors
- Selector list
A, B -
Specifies that both
AandBelements are selected. This is a grouping method to select several matching elements.
Combinators
Combinators are selectors that establish a relationship between two or more simple selectors, such as "A is a child of B" or "A is adjacent to B", creating a complex selector.
- Next-sibling combinator
A + B -
Specifies that the elements selected by both
AandBhave the same parent and that the element selected byBimmediately follows the element selected byAhorizontally. - Subsequent-sibling combinator
A ~ B -
Specifies that the elements selected by both
AandBshare the same parent and that the element selected byAcomes before—but not necessarily immediately before—the element selected byB. - Child combinator
A > B -
Specifies that the element selected by
Bis the direct child of the element selected byA. - Descendant combinator
A B -
Specifies that the element selected by
Bis a descendant of the element selected byA, but is not necessarily a direct child. - Column combinator
A || BExperimental -
Specifies that the element selected by
Bis located within the table column specified byA. Elements which span multiple columns are considered to be a member of all of those columns.
Pseudo
- Pseudo classes
: -
Specifies a special state of the selected element(s).
- Pseudo elements
:: -
Represents entities that are not included in HTML.
See also selectors in the Selectors specification and the pseudo-element specification.
Concepts
Syntax and semantics
Values
Layout
DOM-CSS / CSSOM
Major object types
Document.styleSheetsstyleSheets[i].cssRulescssRules[i].cssText(selector & style)cssRules[i].selectorTextHTMLElement.styleHTMLElement.style.cssText(just style)Element.classNameElement.classList
Important methods
See also
- Mozilla CSS extensions (prefixed with
-moz-) - WebKit CSS extensions (mostly prefixed with
-webkit-)