ry - SVG: Scalable Vector Graphics 编辑

The ry attribute defines a radius on the y-axis.

Two elements are using this attribute: <ellipse>, and <rect>

html,body,svg { height:100% }
<svg viewBox="0 0 300 200" xmlns="http://www.w3.org/2000/svg">
  <ellipse cx="50"  cy="50" ry="0"  rx="25" />
  <ellipse cx="150" cy="50" ry="25" rx="25" />
  <ellipse cx="250" cy="50" ry="50" rx="25" />

  <rect x="20"  y="120" width="60" height="60" ry="0"   rx="15"/>
  <rect x="120" y="120" width="60" height="60" ry="15"  rx="15"/>
  <rect x="220" y="120" width="60" height="60" ry="150" rx="15"/>
</svg>

ellipse

For <ellipse>, ry defines the y-radius of the shape. With a value lower or equal to zero the ellipse won't be drawn at all.

Value<length> | <percentage> | auto
Default valueauto
AnimatableYes

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

rect

For <rect>, ry defines the y-axis radius of the ellipse used to round off the corners of the rectangle.

The way the value of the ry attribute is interpreted depend on both the rx attribute and the width of the rectangle:

  • If a properly specified value is provided for ry but not for rx (or the opposite), then the browser will consider the missing value equal to the defined one.
  • If neither ry nor rx has a properly specified value, then the browser will draw a rectangle with square corners.
  • If ry is greater than half of the width of the rectangle, then the browser will consider the value for ry as half of the width of the rectangle.
Value<length> | <percentage> | auto
Default valueauto
AnimatableYes

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

Specifications

SpecificationStatusComment
Scalable Vector Graphics (SVG) 2
The definition of 'ry' in that specification.
Candidate RecommendationDefinition as a geometry property
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'ry' in that specification.
RecommendationInitial definition for <ellipse>
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'ry' in that specification.
RecommendationInitial definition for <rect>

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

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

发布评论

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

词条统计

浏览:129 次

字数:5473

最后编辑:7 年前

编辑次数:0 次

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