CSS 參考
使用此 CSS 參考來瀏覽所有標準 CSS 屬性、偽類、偽元素、資料型別、函式和 @ 規則的按字母順序排列的索引。你還可以瀏覽關鍵的 CSS 概念和按型別組織的選擇器列表。此外,還包括一個簡要的 DOM-CSS / CSSOM 參考。
基本規則語法
樣式規則語法
style-rule ::=
selectors-list {
properties-list
}
其中
selectors-list ::=
selector[:pseudo-class] [::pseudo-element]
[, selectors-list]
properties-list ::=
[property : value] [; properties-list]
請參閱下文中的選擇器、偽類和偽元素的索引。每個指定值的語法取決於為每個指定屬性定義的資料型別。
樣式規則示例
css
strong {
color: red;
}
div.menu-bar li:hover > ul {
display: block;
}
有關選擇器語法的入門介紹,請參閱我們的 CSS 選擇器指南。請注意,規則定義中的任何語法錯誤都會導致整個規則無效。瀏覽器會忽略無效的規則。請注意,CSS 規則定義完全是基於文字的(Unicode),而 DOM-CSS / CSSOM(規則管理系統)是基於物件的。
@ 規則語法
由於 @ 規則的結構差異很大,請參閱 @ 規則以查詢你想要的特定規則的語法。
索引
備註: 此索引不包括 SVG 專用的表示屬性,這些屬性可在 SVG 元素上用作 CSS 屬性。
備註: 本索引中的屬性名稱不包括 JavaScript 名稱,這些名稱與 CSS 標準名稱不同。
-
--*-webkit-line-clamp-webkit-text-fill-color-webkit-text-stroke-webkit-text-stroke-color-webkit-text-stroke-width
A
abs()accent-coloracos():active:active-view-transition:active-view-transition-type()additive-symbols (@counter-style)::after (:after)align-contentalign-itemsalign-selfalignment-baselineallanchor()anchor-nameanchor-scopeanchor-size()<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():autofill
B
::backdropbackdrop-filterbackface-visibilitybackgroundbackground-attachmentbackground-blend-modebackground-clipbackground-colorbackground-imagebackground-originbackground-positionbackground-position-xbackground-position-ybackground-repeatbackground-sizebase-palette (@font-palette-values)baseline-shift<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-left-cornerbox-decoration-breakbox-shadowbox-sizingbreak-afterbreak-beforebreak-insidebrightness():buffering
C
calc()calc-size()capcaption-sidecaretcaret-colorcaret-shapech@character-variant@charset:checked::checkmarkcircle()clamp()clearclip-pathclip-rulecm<color>colorcolor-interpolation-filterscolor-mix()color-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-width@containercontainercontainer-namecontainer-typecontentcontent-visibilitycontrast()cos()<counter>counter-incrementcounter-resetcounter-set@counter-stylecounters()cross-fade()cubic-bezier()::cue::cue()::cue-region::cue-region():currentcursor<custom-ident>cxcy
D
d<dashed-ident>:default:defineddegdescent-override (@font-face)::details-content<dimension>:dir()direction:disableddisplay<display-box><display-inside><display-internal><display-legacy><display-listitem><display-outside>dominant-baselinedpcmdpidppxdrop-shadow()
E
F
fallback (@counter-style)field-sizing::file-selector-buttonfillfill-opacityfill-rulefilter<filter-function>:first:first-child::first-letter (:first-letter)::first-line (:first-line):first-of-typefit-content()<flex>flexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloatflood-colorflood-opacity: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-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)font-widthforced-color-adjustformat()fr<frequency><frequency-percentage>:fullscreen:future
G
gapgrad<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
Hzhanging-punctuation:has():has-slottedheight::highlight()@historical-forms:host:host():host-context():hoverhsl()hue-rotate()hwb()hyphenate-characterhyphenate-limit-charshyphenshypot()
I
ic<ident><image>image()image-orientationimage-renderingimage-resolutionimage-set()@importin:in-range:indeterminateinheritinherits (@property)initialinitial-letterinitial-letter-aligninitial-value (@property)inline-sizeinsetinset()inset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-start<integer>interpolate-size:invalidinvert():is()isolation
J
K
L
lab():lang():last-child:last-of-type@layerlayer()layer() (@import)lch()leader():leftleft@left-top<length><length-percentage>letter-spacinglight-dark()lighting-colorline-breakline-clampline-gap-override (@font-face)line-heightline-height-step<line-style>linear()linear-gradient():linklist-stylelist-style-imagelist-style-positionlist-style-typelocal():local-linklog()
M
marginmargin-blockmargin-block-endmargin-block-startmargin-bottommargin-inlinemargin-inline-endmargin-inline-startmargin-leftmargin-rightmargin-topmargin-trim::markermarkermarker-endmarker-midmarker-startmarks (@page)maskmask-bordermask-border-modemask-border-outsetmask-border-repeatmask-border-slicemask-border-sourcemask-border-widthmask-clipmask-compositemask-imagemask-modemask-originmask-positionmask-repeatmask-sizemask-typemath-depthmath-shiftmath-stylematrix()matrix3d()max()max-block-sizemax-heightmax-inline-sizemax-linesmax-width@mediamin()min-block-sizemin-heightmin-inline-sizemin-widthminmax()mix-blend-modemmmod():modalms:muted
N
@namespacenavigation (@view-transition)negative (@counter-style):not():nth-child():nth-last-child():nth-last-of-type():nth-of-type()<number>
O
object-fitobject-positionobject-view-boxoffsetoffset-anchoroffset-distanceoffset-pathoffset-positionoffset-rotateoklab()oklch():only-child:only-of-typeopacityopacity():open:optionalorder@ornamentsorphans:out-of-rangeoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-anchoroverflow-blockoverflow-clip-marginoverflow-inlineoverflow-wrapoverflow-xoverflow-yoverlayoverride-colors (@font-palette-values)overscroll-behavioroverscroll-behavior-blockoverscroll-behavior-inlineoverscroll-behavior-xoverscroll-behavior-y
P
偽類偽元素pad (@counter-style)paddingpadding-blockpadding-block-endpadding-block-startpadding-bottompadding-inlinepadding-inline-endpadding-inline-startpadding-leftpadding-rightpadding-top@pagepagepage-orientation (@page)paint()paint-orderpalette-mix()::part():pastpath():pausedpc<percentage>perspectiveperspective()perspective-origin::picker()::picker-icon:picture-in-pictureplace-contentplace-itemsplace-self::placeholder:placeholder-shown:playingpointer-eventspolygon():popover-open<position>positionposition-anchorposition-area@position-tryposition-tryposition-try-fallbacksposition-try-orderposition-visibilitypow()prefix (@counter-style)print-color-adjust@propertyptpx
Q
R
rradradial-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-top:rootrotaterotate()rotate3d()rotateX()rotateY()rotateZ()round()row-gapruby-alignruby-mergeruby-overhangruby-positionrxry
S
ssaturate()scalescale()scale3d()scaleX()scaleY()scaleZ():scope@scopescroll()scroll-behaviorscroll-initial-targetscroll-marginscroll-margin-blockscroll-margin-block-endscroll-margin-block-startscroll-margin-bottomscroll-margin-inlinescroll-margin-inline-endscroll-margin-inline-startscroll-margin-leftscroll-margin-rightscroll-margin-top::scroll-marker::scroll-marker-groupscroll-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-state()scroll-timelinescroll-timeline-axisscroll-timeline-namescrollbar-colorscrollbar-gutterscrollbar-width:seeking::selectionselector()sepia()shape-image-thresholdshape-marginshape-outsideshape-renderingsign()sin()size (@page)size-adjust (@font-face)skew()skewX()skewY()::slotted()speak-asspeak-as (@counter-style)::spelling-errorsqrt()src (@font-face):stalled@starting-style:state()steps()stop-colorstop-opacity<string>strokestroke-colorstroke-dasharraystroke-dashoffsetstroke-linecapstroke-linejoinstroke-miterlimitstroke-opacitystroke-widthstyle()@styleset@stylisticsuffix (@counter-style)@supportssupports() (@import)@swashsymbols (@counter-style)symbols()syntax (@property)system (@counter-style)
T
tab-sizetable-layouttan():targettarget-counter()target-counters():target-current::target-texttarget-text():target-withintext-aligntext-align-lasttext-anchortext-boxtext-box-edgetext-box-trimtext-combine-uprighttext-decorationtext-decoration-colortext-decoration-linetext-decoration-skiptext-decoration-skip-inktext-decoration-styletext-decoration-thickness<text-edge>text-emphasistext-emphasis-colortext-emphasis-positiontext-emphasis-styletext-indenttext-justifytext-orientationtext-overflowtext-renderingtext-shadowtext-size-adjusttext-spacing-trimtext-transformtext-underline-offsettext-underline-positiontext-wraptext-wrap-modetext-wrap-style<time><time-percentage>timeline-scopetop@top-left-cornertouch-actiontransformtransform-box<transform-function>transform-origintransform-styletransitiontransition-behaviortransition-delaytransition-durationtransition-propertytransition-timing-functiontranslatetranslate()translate3d()translateX()translateY()translateZ()turntype()types (@view-transition)
U
V
:validvar()vector-effectvertical-alignvhview()view-timelineview-timeline-axisview-timeline-insetview-timeline-name::view-transition@view-transitionview-transition-class::view-transition-group()::view-transition-image-pair()view-transition-name::view-transition-new()::view-transition-old()visibility:visitedvmaxvmin:volume-lockedvw
W
:where()white-spacewhite-space-collapsewidowswidthwill-changeword-breakword-spacingword-wrapwriting-mode
X
Y
Z
選擇器
以下是各種 選擇器,它們允許樣式根據 DOM 中元素的各種特徵來設定條件。
基本選擇器
基本選擇器是基礎選擇器;這些是最基本的選擇器,它們經常組合起來建立其他更復雜的選擇器。
分組選擇器
- 選擇器列表
A, B -
指定
A和B元素都會被選中。這是一種選擇多個匹配元素的分組方法。
組合器
組合器是建立兩個或多個簡單選擇器之間關係的選擇器,例如“A 是 B 的子元素”或“A 與 B 相鄰”,從而建立一個複雜的選擇器。
偽類與偽元素
另請參閱選擇器規範中的選擇器和偽元素規範。
概念
語法和語義
值
佈局
DOM-CSS / CSSOM
主要物件型別
重要方法
另見
- Mozilla CSS 擴充套件(以
-moz-為字首) - WebKit CSS 擴充套件(主要以
-webkit-為字首)