1. 面向开发者的 Web 技术
  2. SVG:可缩放矢量图形
  3. 参考
  4. SVG 元素参考
  5. path

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

path

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2015年7月⁩.

* Some parts of this feature may have varying levels of support.

起步 本教程将教你开始使用 SVG 路径。

path 元素是用来定义形状的通用元素。所有的基本形状都可以用 path 元素来创建。

使用上下文

类别图形元素、形状元素
允许的内容任意数量、任意顺序的下列元素:
动画元素
描述性元素

示例

html,
body,
svg {
 height: 100%;
}
html
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
 <path
 d="M 10,30
 A 20,20 0,0,1 50,30
 A 20,20 0,0,1 90,30
 Q 90,60 50,90
 Q 10,60 10,30 z" />
</svg>

输出结果:

属性

全局属性

专有属性

DOM 接口

该元素实现了 SVGPathElement 接口。

浏览器兼容性

参见

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /