x - SVG: Scalable Vector Graphics 编辑

The x attribute defines a x-axis coordinate in the user coordinate system.

Thirty seven elements are using this attribute: <altGlyph>, <feBlend>, <feColorMatrix>, <feComponentTransfer>, <feComposite>, <feConvolveMatrix>, <feDiffuseLighting>, <feDisplacementMap>, <feDropShadow>, <feFlood>, <feFuncA>, <feFuncB>, <feFuncG>, <feFuncR>, <feGaussianBlur>, <feImage>, <feMerge>, <feMergeNode>, <feMorphology>, <feOffset>, <fePointLight>, <feSpecularLighting>, <feSpotLight>, <feTile>, <feTurbulence>, <filter>, <foreignObject>, <glyphRef>, <image>, <mask>, <pattern>, <rect>, <svg>, <text>, <tref>, <tspan>, and <use>

html,body,svg { height:100% }
<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
  <rect x="20"  y="20" width="60" height="60" />
  <rect x="120" y="20" width="60" height="60" />
  <rect x="220" y="20" width="60" height="60" />
</svg>

altGlyph

Warning: As of SVG2 <altGlyph> is deprecated and shouldn't be used.

For <altGlyph>, x defines the x-axis coordinate of the alternate glyph.

ValueList of <length>
Default valuenone
AnimatableYes

feBlend

For <feBlend>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feColorMatrix

For <feColorMatrix>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feComponentTransfer

For <feComponentTransfer>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feComposite

For <feComposite>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feConvolveMatrix

For <feConvolveMatrix>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feDiffuseLighting

For <feDiffuseLighting>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feDisplacementMap

For <feDisplacementMap>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feDropShadow

For <feDropShadow>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feFlood

For <feFlood>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feFuncA

For <feFuncA>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feFuncB

For <feFuncB>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feFuncG

For <feFuncG>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feFuncR

For <feFuncR>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feGaussianBlur

For <feGaussianBlur>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feImage

For <feImage>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feMerge

For <feMerge>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feMergeNode

For <feMergeNode>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feMorphology

For <feMorphology>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feOffset

For <feOffset>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

fePointLight

For <fePointLight>, x defines the x location for the light source in the coordinate system defined by the primitiveUnits attribute on the <filter> element.

Value<number>
Default value0
AnimatableYes

feSpecularLighting

For <feSpecularLighting>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feSpotLight

For <feSpotLight>, x defines the x location for the light source in the coordinate system defined by the primitiveUnits attribute on the <filter> element.

Value<number>
Default value0
AnimatableYes

feTile

For <feTile>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

feTurbulence

For <feTurbulence>, x defines the minimum x coordinate for the rendering area of the primitive.

Value<length> | <percentage>
Default value0%
AnimatableYes

filter

For <filter>, x defines the x coordinate of the upper left corner for the rendering area of the filter.

Value<length> | <percentage>
Default value-10%
AnimatableYes

foreignObject

For <foreignObject>, x defines the  x coordinate of the uper left corner of its viewport.

Value<length> | <percentage>
Default value0
AnimatableYes

Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for <foreignObject>.

glyphRef

Warning: As of SVG2 <glyphRef> is deprecated and shouldn't be used.

For <glyphRef>, x defines the x-axis coordinate of the glyph.

Value<number>
Default value0 for the first glyphRef, and the end x coordinate of the previous <glyphRef> for all subsequent sibling <glyphRef>.
AnimatableYes

image

For <image>, x defines the  x coordinate of the uper left corner of the image.

Value<length> | <percentage>
Default value0
AnimatableYes

Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for images.

mask

For <mask>, x defines the  x coordinate of the uper left corner of its area of effect. The exact effect of this attribute is influenced by the maskUnits attribute.

Value<length> | <percentage>
Default value-10%
AnimatableYes

pattern

For <pattern>, x defines the  x coordinate of the uper left corner of the tile pattern. The exact effect of this attribute is influenced by the patternUnits and patternTransform attributes.

Value<length>
Default value0
AnimatableYes

rect

For <rect>, x defines the  x coordinate of the uper left corner of the shape.

Value<length> | <percentage>
Default value0
AnimatableYes

Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for rectangles.

svg

For <svg>, x defines the  x coordinate of the uper left corner of its viewport.

Value<length> | <percentage>
Default value0
AnimatableYes

Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>.

text

For <text>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction.

If there are multiple values, x defines the x coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored.

ValueList of (<length> | <percentage>)
Default value0
AnimatableYes

Example

html,body,svg { height:100% }
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
  <!-- horizontal line to materialized the text base line -->
  <line x1="0" y1="40%" x2="100%" y2="40%" />
  <line x1="0" y1="90%" x2="100%" y2="90%" />

  <!-- vertical line to materialized the x positioning -->
  <line x1="25%" y1="0" x2="25%" y2="100%" />
  <line x1="50%" y1="0" x2="50%" y2="100%" />
  <line x1="75%" y1="0" x2="75%" y2="100%" />

  <!-- x with a single value -->
  <text y="40%" x="50%">SVG</text>

  <!-- x with multiple values -->
  <text y="90%" x="25%, 50%, 75%">SVG</text>
</svg>
text {
  font: 40px sans-serif;
}

line {
  fill: none;
  stroke: red;
  stroke-width: .5px;
  stroke-dasharray: 2px;
}

tref

Warning: As of SVG2 <tref> is deprecated and shouldn't be used.

For <tref>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction.

If there are multiple values, x defines the x coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored.

ValueList of (<length> | <percentage>)
Default value0
AnimatableYes

tspan

For <tspan>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction.

If there are multiple values, x defines the x coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored.

ValueList of (<length> | <percentage>)
Default valuenone
AnimatableYes

Example

html,body,svg { height:100% }
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
  <!-- horizontal line to materialized the text base line -->
  <line x1="0" y1="40%" x2="100%" y2="40%" />
  <line x1="0" y1="90%" x2="100%" y2="90%" />

  <!-- vertical line to materialized the x positioning -->
  <line x1="25%" y1="0" x2="25%" y2="100%" />
  <line x1="50%" y1="0" x2="50%" y2="100%" />
  <line x1="75%" y1="0" x2="75%" y2="100%" />

  <text>
    <!-- x with a single value -->
    <tspan y="40%" x="50%">SVG</tspan>

    <!-- x with multiple values -->
    <tspan y="90%" x="25%, 50%, 75%">SVG</tspan>
  </text>
</svg>
text {
  font: 40px sans-serif;
}

line {
  fill: none;
  stroke: red;
  stroke-width: .5px;
  stroke-dasharray: 2px;
}

use

For <use>, x defines the  x coordinate of the uper left corner of the referenced element.

Value<length> | <percentage>
Default value0
AnimatableYes

Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for used elements.

Specifications

SpecificationStatusComment
Filter Effects Module Level 1
The definition of 'x' in that specification.
Working DraftDefinition for <filter>
Filter Effects Module Level 1
The definition of 'x' in that specification.
Working DraftDefinition for <feSpotLight>
Filter Effects Module Level 1
The definition of 'x' in that specification.
Working DraftDefinition for <fePointLight>
Filter Effects Module Level 1
The definition of 'x' in that specification.
Working DraftDefinition for filter primitives
CSS Masking Module Level 1
The definition of 'x' in that specification.
Candidate RecommendationDefinition for <mask>
Scalable Vector Graphics (SVG) 2
The definition of 'x' in that specification.
Candidate RecommendationDefinition as a geometry property
Scalable Vector Graphics (SVG) 2
The definition of 'x' in that specification.
Candidate RecommendationDefinition for <pattern>
Scalable Vector Graphics (SVG) 2
The definition of 'x' in that specification.
Candidate RecommendationDefinition for <text> and <tspan>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <cursor>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <foreignObject>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <pattern>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <image>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <svg>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <use>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <fePointLight>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <feSpotLight>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <filter>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for filter primitives
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <mask>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <altGlyph>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <glyphRef>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <text>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <tref> and <tspan>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'x' in that specification.
RecommendationInitial definition for <rect>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:119 次

字数:46075

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文