<rect>

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

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

<rect> 요소는 위치, 너비, 그리고 높이로 정의된 사각형을 그리는 기본 SVG 모양입니다. 이 직사각형은 둥근 모서리를 가질 수 있습니다.

예제

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>

속성

x

직사각형의 x 좌표입니다. 값 유형: <length>|<percentage> ; 기본값: 0; 애니메이션 가능:

y

직사각형의 y 좌표입니다. 값 유형: <length>|<percentage> ; 기본 값: 0; 애니메이션 가능:

width

직사각형의 너비. 값 유형: auto|<length>|<percentage> ; 기본 값: auto; 애니메이션 가능:

height

직사각형의 높이. 값 유형: auto|<length>|<percentage> ; 기본 값: auto; 애니메이션 가능:

rx

직사각형의 가로 모서리 반지름입니다. ry가 지정 된 경우 ry가 기본값입니다. 값 유형: auto|<length>|<percentage> ; 기본 값: auto; 애니메이션 가능:

ry

직사각형의 세로 모서리 반지름입니다. rx가 지정 된 경우 rx가 기본값입니다. 값 유형: auto|<length>|<percentage> ; 기본 값: auto; 애니메이션 가능:

pathLength

직사각형 둘레의 총 길이(사용자 단위). 값 유형: <number> ; 기본 값: 없음; 애니메이션 가능:

참고 : SVG2부터 시작하여 x, y, width, height, rx 그리고 ry는 기하학 속성입니다. 즉, 해당 속성을 해당 요소의 CSS 속성으로도 사용할 수 있습니다.

전역 속성

코어 속성

특히: id, tabindex

스타일 속성

class, style

조건부 처리 속성

특히: requiredExtensions, systemLanguage

이벤트 속성

전역 이벤트 속성, 그래픽 이벤트 속성

프레젠테이션 속성

특히: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, fill, fill-opacity, fill-rule, filter, mask, opacity, pointer-events, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility

ARIA 속성

aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role

사용 참고 사항

카테고리기본 모양 요소, 그래픽 요소, 모양 요소
허용된 콘텐츠순서에 상관없는 다음 요소 중 임의의 개수:
애니메이션 요소
설명 요소

명세서

Specification
Scalable Vector Graphics (SVG) 2
# RectElement

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
rect
fill
context-fill value
height
rx
ry
systemLanguage
width
x
y

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

같이 보기