首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

x1

对于<line>元素,这个属性定义了行首的x轴坐标。如果未指定属性,则效果就好像指定了值0

对于该<linearGradient>元素,此属性定义<stop>元素映射到的矢量梯度起点的x轴坐标。如果未指定属性,则效果就好像指定了0%的值。

使用上下文

Categories

None

Value

<coordinate>

Animatable

Yes

Normative document

SVG 1.1 (2nd Edition): The line element SVG 1.1 (2nd Edition): The linearGradient element

<coordinate>

<坐标>是用户坐标系中的长度,它是用户坐标系原点沿着相关轴(X坐标的X轴,Y坐标的Y轴)的给定距离。它的语法与<length>相同。

在SVG DOM中,一个<坐标>被表示为一个SVGLength或一个SVGAnimatedLength

示例

<line>元素上的x1属性

Source code

Output result

<?xml version="1.0"?> <svg width="120" height="120" viewPort="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg"> <line x1="10" y1="10" x2="60" y2="110" stroke="black" /> <line x1="60" y1="10" x2="60" y2="110" stroke="black" /> <line x1="110" y1="10" x2="60" y2="110" stroke="black" /> </svg>

?

<linearGradient>元素上的x1属性

Source code

Output result

<?xml version="1.0"?> <svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" > <defs> <linearGradient id="MyGradient"> <stop offset="5%" stop-color="green"/> <stop offset="95%" stop-color="gold"/> </linearGradient> </defs> <rect fill="url(#MyGradient)" x="10" y="10" width="100" height="100"/> </svg>

?

元素

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

  • <line>
  • <linearGradient>

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com