SVG 元素可以通过属性来修改,这些属性指定有关如何处理或渲染元素的详细信息。
下面列出了 SVG 中所有的可用属性以及参考文档的链接,以帮助你了解哪些元素支持它们,以及它们如何工作。
SVG 属性(从 A-Z 排序)
A
- accumulate
- additive
- alignment-baseline
- amplitude
- attributeName
- attributeType
- azimuth
B
- baseFrequency
- baseline-shift
- baseProfile
- begin
- bias
- by
C
- calcMode
- class
- clip
- clipPathUnits
- clip-path
- clip-rule
- color
- color-interpolation
- color-interpolation-filters
- color-profile
- color-rendering
- crossorigin
- cursor
- cx
- cy
D
- d
- decelerate
- diffuseConstant
- direction
- display
- divisor
- dominant-baseline
- dur
- dx
- dy
E
- edgeMode
- elevation
- end
- exponent
F
- fill
- fill-opacity
- fill-rule
- filter
- filterUnits
- flood-color
- flood-opacity
- font-family
- font-size
- font-size-adjust
- font-stretch
- font-style
- font-variant
- font-weight
- format
- from
- fr
- fx
- fy
G
- glyph-orientation-horizontal
- glyph-orientation-vertical
- gradientTransform
- gradientUnits
H
- height
- href
- hreflang
I
- id
- image-rendering
- in
- in2
- intercept
K
- k1
- k2
- k3
- k4
- kernelMatrix
- kernelUnitLength
- kerning
- keyPoints
- keySplines
- keyTimes
L
- lang
- lengthAdjust
- letter-spacing
- lighting-color
- limitingConeAngle
- local
M
- marker-end
- marker-mid
- marker-start
- markerHeight
- markerUnits
- markerWidth
- mask
- maskContentUnits
- maskUnits
- max
- media
- method
- min
- mode
N
- numOctaves
O
- offset
- opacity
- operator
- order
- orient
- origin
- overflow
P
- paint-order
- path
- pathLength
- patternContentUnits
- patternTransform
- patternUnits
- ping
- pointer-events
- points
- pointsAtX
- pointsAtY
- pointsAtZ
- preserveAlpha
- preserveAspectRatio
- primitiveUnits
R
- r
- radius
- referrerPolicy
- refX
- refY
- rel
- rendering-intent
- repeatCount
- repeatDur
- requiredExtensions
- requiredFeatures
- restart
- result
- rotate
- rx
- ry
S
- scale
- seed
- shape-rendering
- slope
- spacing
- specularConstant
- specularExponent
- speed
- spreadMethod
- startOffset
- stdDeviation
- stitchTiles
- stop-color
- stop-opacity
- stroke
- stroke-dasharray
- stroke-dashoffset
- stroke-linecap
- stroke-linejoin
- stroke-miterlimit
- stroke-opacity
- stroke-width
- style
- surfaceScale
- systemLanguage
T
- tabindex
- tableValues
- target
- targetX
- targetY
- text-anchor
- text-decoration
- text-rendering
- textLength
- to
- transform
- transform-origin
- type
U
- unicode-bidi
V
- vector-effect
- version
- viewBox
- visibility
W
- width
- word-spacing
- writing-mode
X
- x
- x1
- x2
- xChannelSelector
- xlink:actuate
- xlink:arcrole
- xlink:href
- xlink:role
- xlink:show
- xlink:title
- xlink:type
- xml:base
- xml:lang
- xml:space
Y
- y
- y1
- y2
- yChannelSelector
Z
- z
- zoomAndPan
SVG 属性(按类别分类)
通用属性
-
核心属性
- id
- class
- style
- lang
- tabindex
- xml:base
- xml:lang
- xml:space
-
条件处理属性
- requiredExtensions
- requiredFeatures
- systemLanguage
XLink 属性
- xlink:href
- xlink:type
- xlink:role
- xlink:arcrole
- xlink:title
- xlink:show
- xlink:actuate
表现属性
[!NOTE] 所有 SVG 表现属性都可以作为 CSS 属性来使用。
- alignment-baseline
- baseline-shift
- clip
- clip-path
- clip-rule
- color
- color-interpolation
- color-interpolation-filters
- color-profile
- color-rendering
- cursor
- d
- direction
- display
- dominant-baseline
- fill
- fill-opacity
- fill-rule
- filter
- flood-color
- flood-opacity
- font-family
- font-size
- font-size-adjust
- font-stretch
- font-style
- font-variant
- font-weight
- glyph-orientation-horizontal
- glyph-orientation-vertical
- image-rendering
- kerning
- letter-spacing
- lighting-color
- marker-end
- marker-mid
- marker-start
- mask
- opacity
- overflow
- pointer-events
- shape-rendering
- stop-color
- stop-opacity
- stroke
- stroke-dasharray
- stroke-dashoffset
- stroke-linecap
- stroke-linejoin
- stroke-miterlimit
- stroke-opacity
- stroke-width
- text-anchor
- text-decoration
- text-rendering
- transform
- transform-origin
- unicode-bidi
- vector-effect
- visibility
- word-spacing
- writing-mode
滤镜属性
- 滤镜原语属性
- : height、result、width、x、y
- 传递函数属性
- : type、tableValues、slope、intercept、amplitude、exponent、offset
动画属性
- 动画目标元素属性
- : href
- 动画属性目标属性
- : attributeType、attributeName
- 动画时间属性
- : begin、dur、end、min、max、restart、repeatCount、repeatDur、fill
- 动画取值属性
- : calcMode、values、keyTimes、keySplines、from、to、by、autoReverse、accelerate、decelerate
- 动画累加属性
- : additive、accumulate
事件属性
onabortonactivateonbeginoncanceloncanplayoncanplaythroughonchangeonclickoncloseoncuechangeondblclickondragondragendondragenterondragleaveondragoverondragstartondropondurationchangeonemptiedonendonendedonerroronerroronfocusonfocusinonfocusoutoninputoninvalidonkeydownonkeypressonkeyuponloadonloadeddataonloadedmetadataonloadstartonmousedownonmouseenteronmouseleaveonmousemoveonmouseoutonmouseoveronmouseuponmousewheelonpauseonplayonplayingonprogressonratechangeonrepeatonresetonresizeonresizeonscrollonscrollonseekedonseekingonselectonshowonstalledonsubmitonsuspendontimeupdateontoggleonunloadonvolumechangeonwaiting
参见
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
