Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. SVG
  3. Reference
  4. Attributes
  5. x

x

Thex attribute defines an x-axis coordinate in the user coordinate system.

Elements

You can use this attribute with the SVG elements described in the sections below.

<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 theprimitiveUnits 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 theprimitiveUnits 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 upper left corner of its viewport.

Value<length> |<percentage>
Default value0
AnimatableYes

Note:The x-axis coordinate of the<foreignObject> can also be defined with thexgeometry property. If set in CSS, thex property value overrides thex attribute value.

<image>

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

Value<length> |<percentage>
Default value0
AnimatableYes

Note:The x-axis coordinate of the<image> can also be defined with thexgeometry property. If set in CSS, thex property value overrides thex attribute value.

<mask>

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

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

<pattern>

For<pattern>,x defines the x coordinate of the upper left corner of the tile pattern. The exact effect of this attribute is influenced by thepatternUnits andpatternTransform attributes.

Value<length>
Default value0
AnimatableYes

<rect>

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

Value<length> |<percentage>
Default value0
AnimatableYes

Note:The x-axis coordinate of the<rect> can also be defined with thexgeometry property. If set in CSS, thex property value overrides thex attribute value.

<svg>

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

Value<length> |<percentage>
Default value0
AnimatableYes

Note:The x-axis coordinate of the<svg> can also be defined with thexgeometry property. If set in CSS, thex property value overrides thex attribute value.

<text>

For<text>, if it contains a single value,x defines the x coordinate where thecontent text position must be placed. Thecontent text position is usually a point on the baseline of the first line of text. The exactcontent text position is influenced by other properties, such astext-anchor ordirection.

If it contains multiple values,x defines the x coordinate of each individual glyph from the text. If there are fewer values than glyphs, the remaining glyphs are placed in line with the last positioned glyph. If there are more values than glyphs, the extra values are ignored.

Value List of (<length> |<percentage>)
Default value0
AnimatableYes
html,body,svg {  height: 100%;}
html
<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>
css
text {  font: 40px sans-serif;}line {  fill: none;  stroke: red;  stroke-width: 0.5px;  stroke-dasharray: 2px;}

<tspan>

For<tspan>, if it contains a single value,x defines the x coordinate where thecontent text position must be placed. Thecontent text position is usually a point on the baseline of the first line of text. The exactcontent text position is influenced by other properties, such astext-anchor ordirection.

If it contains multiple values,x defines the x coordinate of each individual glyph from the text. If there are fewer values than glyphs, the remaining glyphs are placed in line with the last positioned glyph. If there are more values than glyphs, the extra values are ignored.

Value List of (<length> |<percentage>)
Default valuenone
AnimatableYes
html,body,svg {  height: 100%;}
html
<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>
css
text {  font: 40px sans-serif;}line {  fill: none;  stroke: red;  stroke-width: 0.5px;  stroke-dasharray: 2px;}

<use>

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

Value<length> |<percentage>
Default value0
AnimatableYes

Note:Declaring a<length> or<percentage> value in CSS using thexgeometry property overrides the x-axis coordinate of the<use> set by thex attribute in some browsers.This behavior is non-standard, deprecated, and likely to be removed in future browser versions.

Examples

This example contains three<rect> elements, each with anx value smaller than the previous value.

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

Specifications

Specification
Filters 1.0
# element-attrdef-filter-x
Filters 1.0
# element-attrdef-fespotlight-x
Filters 1.0
# element-attrdef-fepointlight-x
Filters 1.0
# element-attrdef-filter-primitive-x
CSS Masks
# element-attrdef-mask-x
Scalable Vector Graphics (SVG) 2
# X
Scalable Vector Graphics (SVG) 2
# PatternElementXAttribute
Scalable Vector Graphics (SVG) 2
# TextElementXAttribute

See also

  • CSSx property

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp