大网数据广告活动
Web 标准与前端开发

CSS 属性

· 52CE 我爱测

在 CSS 声明 中,CSS ***属性***用于设置选中元素某些样式参数的内容。例如,opacity 属性用于设置选中元素的不透明度,从而可以控制该元素后面的内容是否可见:

在 CSS 声明 中,CSS 属性用于设置选中元素某些样式参数的内容。例如,opacity 属性用于设置选中元素的不透明度,从而可以控制该元素后面的内容是否可见:

/* 设置 <img> 元素的不透明度为 0.8 */
img {
  opacity: 0.8;
}

每个属性都有一个名称(例如 opacity)、一个值(例如 0.8)以及在文档渲染时的定义行为。CSS 还定义了简写属性,以便于在单个声明中指定多个相关属性。例如,margin 属性是 margin-top、margin-right、margin-bottom 和 margin-left 的简写属性,用于设置元素四边的外边距:

/* 设置 <img> 元素的外边距为 1rem */
img {
  margin: 1rem;
}

语法

selector {
  property: value;
}

属性的字典序索引

CSS 规范定义的标准属性包括以下几种:

杂项

A

  • accent-color
  • align-content
  • align-items
  • align-self
  • alignment-baseline
  • all(简写)
  • anchor-name
  • animation-composition
  • animation-delay
  • animation-direction
  • animation-duration
  • animation-fill-mode
  • animation-iteration-count
  • animation-name
  • animation-play-state
  • animation-range-end
  • animation-range-start
  • animation-range(简写)
  • animation-timeline
  • animation-timing-function
  • animation(简写)
  • appearance
  • aspect-ratio

B

  • backdrop-filter
  • backface-visibility
  • background-attachment
  • background-blend-mode
  • background-clip
  • background-color
  • background-image
  • background-origin
  • background-position-x
  • background-position-y
  • background-position
  • background-repeat
  • background-size
  • background(简写)
  • block-size

Border-*

  • border-block-color
  • border-block-end-color
  • border-block-end-style
  • border-block-end-width
  • border-block-end(简写)
  • border-block-start-color
  • border-block-start-style
  • border-block-start-width
  • border-block-start(简写)
  • border-block-style
  • border-block-width
  • border-block(简写)
  • border-bottom-color
  • border-bottom-left-radius
  • border-bottom-right-radius
  • border-bottom-style
  • border-bottom-width
  • border-bottom(简写)
  • border-collapse
  • border-color(简写)
  • border-end-end-radius
  • border-end-start-radius
  • border-image-outset
  • border-image-repeat
  • border-image-slice
  • border-image-source
  • border-image-width
  • border-image(简写)
  • border-inline-color
  • border-inline-end-color
  • border-inline-end-style
  • border-inline-end-width
  • border-inline-end(简写)
  • border-inline-start-color
  • border-inline-start-style
  • border-inline-start-width
  • border-inline-start(简写)
  • border-inline-style
  • border-inline-width
  • border-inline(简写)
  • border-left-color
  • border-left-style
  • border-left-width
  • border-left(简写)
  • border-radius(简写)
  • border-right-color
  • border-right-style
  • border-right-width
  • border-right(简写)
  • border-spacing
  • border-start-end-radius
  • border-start-start-radius
  • border-style(简写)
  • border-top-color
  • border-top-left-radius
  • border-top-right-radius
  • border-top-style
  • border-top-width
  • border-top(简写)
  • border-width(简写)
  • border(简写)

B - C

  • bottom
  • box-align
  • box-decoration-break
  • box-direction
  • box-flex-group
  • box-flex
  • box-lines
  • box-ordinal-group
  • box-orient
  • box-pack
  • box-shadow
  • box-sizing
  • break-after
  • break-before
  • break-inside
  • caption-side
  • caret-animation
  • caret-color
  • caret-shape
  • caret(简写)
  • clear
  • clip-path
  • clip-rule
  • clip
  • color-interpolation-filters
  • color-interpolation
  • color-scheme
  • color
  • column-count
  • column-fill
  • column-gap
  • column-rule-color
  • column-rule-style
  • column-rule-width
  • column-rule(简写)
  • column-span
  • column-width
  • columns(简写)
  • contain-intrinsic-block-size
  • contain-intrinsic-height
  • contain-intrinsic-inline-size
  • contain-intrinsic-size(简写)
  • contain-intrinsic-width
  • contain
  • container-name
  • container-type
  • container(简写)
  • content-visibility
  • content
  • corner-block-end-shape
  • corner-block-start-shape
  • corner-bottom-left-shape
  • corner-bottom-right-shape
  • corner-bottom-shape(简写)
  • corner-end-end-shape
  • corner-end-start-shape
  • corner-inline-end-shape
  • corner-inline-start-shape
  • corner-left-shape(简写)
  • corner-right-shape(简写)
  • corner-shape(简写)
  • corner-start-end-shape
  • corner-start-start-shape
  • corner-top-left-shape
  • corner-top-right-shape
  • corner-top-shape(简写)
  • counter-increment
  • counter-reset
  • counter-set
  • cursor
  • cx
  • cy

D - F

  • d
  • direction
  • display
  • dominant-baseline
  • dynamic-range-limit
  • empty-cells
  • field-sizing
  • fill-opacity
  • fill-rule
  • fill
  • filter
  • flex-basis
  • flex-direction
  • flex-flow(简写)
  • flex-grow
  • flex-shrink
  • flex-wrap
  • flex(简写)
  • float
  • flood-color
  • flood-opacity
  • font-family
  • font-feature-settings
  • font-kerning
  • font-language-override
  • font-optical-sizing
  • font-palette
  • font-size-adjust
  • font-size
  • font-smooth
  • font-stretch
  • font-style
  • font-synthesis-position
  • font-synthesis-small-caps
  • font-synthesis-style
  • font-synthesis-weight
  • font-synthesis(简写)
  • font-variant-alternates
  • font-variant-caps
  • font-variant-east-asian
  • font-variant-emoji
  • font-variant-ligatures
  • font-variant-numeric
  • font-variant-position
  • font-variant(简写)
  • font-variation-settings
  • font-weight
  • font(简写)
  • forced-color-adjust

G - I

  • gap(简写)
  • grid-area(简写)
  • grid-auto-columns
  • grid-auto-flow
  • grid-auto-rows
  • grid-column-end
  • grid-column-start
  • grid-column(简写)
  • grid-row-end
  • grid-row-start
  • grid-row(简写)
  • grid-template-areas
  • grid-template-columns
  • grid-template-rows
  • grid-template(简写)
  • grid(简写)
  • hanging-punctuation
  • height
  • hyphenate-character
  • hyphenate-limit-chars
  • hyphens
  • image-orientation
  • image-rendering
  • image-resolution
  • initial-letter
  • inline-size
  • inset-block-end
  • inset-block-start
  • inset-block(简写)
  • inset-block(简写)
  • inset-inline-end
  • inset-inline-start
  • inset-inline(简写)
  • inset-inline(简写)
  • inset(简写)
  • inset(简写)
  • interactivity
  • interpolate-size
  • isolation

J - M

  • justify-content
  • justify-items
  • justify-self
  • left
  • letter-spacing
  • lighting-color
  • line-break
  • line-clamp
  • line-height-step
  • line-height
  • list-style-image
  • list-style-position
  • list-style-type
  • list-style(简写)
  • list-style(简写)
  • margin-block-end
  • margin-block-start
  • margin-block(简写)
  • margin-bottom
  • margin-inline-end
  • margin-inline-start
  • margin-inline(简写)
  • margin-left
  • margin-right
  • margin-top
  • margin-trim
  • margin(简写)
  • marker-end
  • marker-mid
  • marker-start
  • marker
  • mask-border-mode
  • mask-border-outset
  • mask-border-repeat
  • mask-border-slice
  • mask-border-source
  • mask-border-width
  • mask-border(简写)
  • mask-clip
  • mask-composite
  • mask-image
  • mask-mode
  • mask-origin
  • mask-position
  • mask-repeat
  • mask-size
  • mask-type
  • mask(简写)
  • math-depth
  • math-shift
  • math-style
  • max-block-size
  • max-height
  • max-inline-size
  • max-width
  • min-block-size
  • min-height
  • min-inline-size
  • min-width
  • mix-blend-mode

O - P

  • object-fit
  • object-position
  • object-view-box
  • offset-anchor
  • offset-distance
  • offset-path
  • offset-position
  • offset-rotate
  • offset(简写)
  • opacity
  • order
  • orphans
  • outline-color
  • outline-offset
  • outline-style
  • outline-width
  • outline(简写)
  • overflow-anchor
  • overflow-block
  • overflow-clip-margin
  • overflow-inline
  • overflow-wrap
  • overflow-x
  • overflow-y
  • overflow(简写)
  • overlay
  • overscroll-behavior-block
  • overscroll-behavior-inline
  • overscroll-behavior-x
  • overscroll-behavior-y
  • overscroll-behavior(简写)
  • padding-block-end
  • padding-block-start
  • padding-block(简写)
  • padding-bottom
  • padding-inline-end
  • padding-inline-start
  • padding-inline(简写)
  • padding-left
  • padding-right
  • padding-top
  • padding(简写)
  • page-break-after
  • page-break-before
  • page-break-inside
  • page
  • paint-order
  • perspective-origin
  • perspective
  • place-content(简写)
  • place-items(简写)
  • place-self(简写)
  • pointer-events
  • position-anchor
  • position-area
  • position-try-fallbacks
  • position-try-order
  • position-try(简写)
  • position-visibility
  • position
  • print-color-adjust

Q - S

  • quotes
  • r
  • reading-flow
  • reading-order
  • resize
  • right
  • rotate
  • row-gap
  • ruby-align
  • ruby-overhang
  • ruby-position
  • rx
  • ry
  • scale
  • scroll-behavior
  • scroll-margin-block-end
  • scroll-margin-block-start
  • scroll-margin-block(简写)
  • scroll-margin-bottom
  • scroll-margin-inline-end
  • scroll-margin-inline-start
  • scroll-margin-inline(简写)
  • scroll-margin-left
  • scroll-margin-right
  • scroll-margin-top
  • scroll-margin(简写)
  • scroll-marker-group
  • scroll-padding-block-end
  • scroll-padding-block-start
  • scroll-padding-block(简写)
  • scroll-padding-bottom
  • scroll-padding-inline-end
  • scroll-padding-inline-start
  • scroll-padding-inline(简写)
  • scroll-padding-left
  • scroll-padding-right
  • scroll-padding-top
  • scroll-padding(简写)
  • scroll-snap-align
  • scroll-snap-stop
  • scroll-snap-type
  • scroll-target-group
  • scroll-timeline-axis
  • scroll-timeline-name
  • scroll-timeline(简写)
  • scrollbar-color
  • scrollbar-gutter
  • scrollbar-width
  • shape-image-threshold
  • shape-margin
  • shape-outside
  • shape-rendering
  • speak-as
  • stop-color
  • stop-opacity
  • stroke-dasharray
  • stroke-dashoffset
  • stroke-linecap
  • stroke-linejoin
  • stroke-miterlimit
  • stroke-opacity
  • stroke-width
  • stroke

T - Z

  • tab-size
  • table-layout
  • text-align-last
  • text-align
  • text-anchor
  • text-autospace
  • text-box-edge
  • text-box-trim
  • text-box(简写)
  • text-combine-upright
  • text-decoration-color
  • text-decoration-inset
  • text-decoration-line
  • text-decoration-skip-ink
  • text-decoration-skip
  • text-decoration-style
  • text-decoration-thickness
  • text-decoration(简写)
  • text-emphasis-color
  • text-emphasis-position
  • text-emphasis-style
  • text-emphasis(简写)
  • text-indent
  • text-justify
  • text-orientation
  • text-overflow
  • text-rendering
  • text-shadow
  • text-size-adjust
  • text-spacing-trim
  • text-transform
  • text-underline-offset
  • text-underline-position
  • text-wrap-mode
  • text-wrap-style
  • text-wrap(简写)
  • timeline-scope
  • top
  • touch-action
  • transform-box
  • transform-origin
  • transform-style
  • transform
  • transition-behavior
  • transition-delay
  • transition-duration
  • transition-property
  • transition-timing-function
  • transition(简写)
  • translate
  • unicode-bidi
  • user-modify
  • user-select
  • vector-effect
  • vertical-align
  • view-timeline-axis
  • view-timeline-inset
  • view-timeline-name
  • view-timeline(简写)
  • view-transition-class
  • view-transition-name
  • visibility
  • white-space-collapse
  • white-space
  • widows
  • width
  • will-change
  • word-break
  • word-spacing
  • writing-mode
  • x
  • y
  • z-index
  • zoom

非标准属性

具有浏览器引擎前缀的非标准属性包括:

-moz- 前缀

  • -moz-float-edge
  • -moz-force-broken-image-icon
  • -moz-orient
  • -moz-user-focus
  • -moz-user-input

-webkit- 前缀

  • -webkit-box-reflect
  • -webkit-border-before(简写)
  • -webkit-mask-box-image(简写)
  • -webkit-mask-composite
  • -webkit-mask-position-x
  • -webkit-mask-position-y
  • -webkit-mask-repeat-x
  • -webkit-mask-repeat-y
  • -webkit-tap-highlight-color
  • -webkit-text-fill-color
  • -webkit-text-security
  • -webkit-text-stroke(简写)
  • -webkit-text-stroke-color
  • -webkit-text-stroke-width
  • -webkit-touch-callout

规范

参见

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。