Movatterモバイル変換


[0]ホーム

URL:


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

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

View in EnglishAlways switch to English

rect

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.

rect元素是 SVG 的一个基本形状,用来创建矩形,基于一个角位置以及它的宽和高。它还可以用来创建圆角矩形。

使用上下文

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

示例

html,body,svg {  height: 100%;}
html
<svg viewBox="0 0 220 100" xmlns="http://www.w3.org/2000/svg">  <!-- Simple rectangle -->  <rect width="100" height="100" />  <!-- Rounded corner rectangle -->  <rect x="120" width="100" height="100" rx="15" /></svg>

属性

全局属性

专有属性

DOM 接口

这个元素实现了SVGRectElement 接口。

浏览器兼容性

参见

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp