在线文档教程
SVG
属性 | Attributes

x

x

该属性表示用户坐标系中的x轴坐标。这个坐标的确切作用取决于每个元素。大多数情况下,它表示参考元素矩形区域左上角的x轴坐标(请参阅每个单独元素的例外情况文档)。它的语法与<length>相同。

如果未指定属性,则效果就好像指定了0值,除了默认值为-10%的<filter>元素和<mask>元素。

使用上下文

CategoriesNone
Value<coordinate>
AnimatableYes
Normative documentSVG 1.1 (2nd Edition): altGlyph element SVG 1.1 (2nd Edition): cursor element SVG 1.1 (2nd Edition): fePointLight element SVG 1.1 (2nd Edition): feSpotLight element SVG 1.1 (2nd Edition): filter element SVG 1.1 (2nd Edition): foreignObject element SVG 1.1 (2nd Edition): glyphRef element SVG 1.1 (2nd Edition): image element SVG 1.1 (2nd Edition): pattern element SVG 1.1 (2nd Edition): rect element SVG 1.1 (2nd Edition): svg element SVG 1.1 (2nd Edition): text element SVG 1.1 (2nd Edition): use element SVG 1.1 (2nd Edition): Filter primitive SVG 1.1 (2nd Edition): mask element SVG 1.1 (2nd Edition): tspan element

示例

<?xml version="1.0"?> <svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <rect x="10" y="10" width="100" height="100"/> </svg>

元素

以下元素可以使用该x属性

  • 过滤原始元素»

  • <altGlyph>

  • <fePointLight>

  • <feSpotLight>

  • <filter>

  • <foreignObject>

  • <glyphRef>

  • <image>

  • <pattern>

  • <rect>

  • <svg>

  • <text>

  • <use>

  • <mask>

  • <tref>

  • <tspan>