CSS <shape> Data Type
The <shape> data type is the rect() shape used by the deprecated clip property. Use clip-path with a <basic-shape> instead.
Description
The <shape> CSS data type defines the region used by the deprecated clip property. Its only form is the rect() function, written with four lengths or auto values that give the top, right, bottom and left edges of the visible rectangle. Everything outside that rectangle is hidden.
The values are measured from the top-left corner of the element's border box: the top and bottom values are distances from the top edge, and the left and right values are distances from the left edge. auto means the matching edge of the border box. The original syntax separated the values with commas, but space-separated values are also accepted. The clip property only works on absolutely or fixed positioned elements.
Both <shape> and the clip property are deprecated. They still work in all browsers for backwards compatibility, most commonly in the "visually hidden" pattern for screen-reader-only text, but new code should use clip-path with a <basic-shape> such as inset() or rect(), which works on any element and supports rounded corners.
Examples:
/* Deprecated: show a 100x60 region of an absolutely positioned image */
.crop {
position: absolute;
clip: rect(10px, 110px, 70px, 10px);
}
/* Modern equivalent with clip-path */
.crop-modern {
clip-path: rect(10px 110px 70px 10px);
}
/* Common visually-hidden pattern */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
clip-path: inset(50%);
white-space: nowrap;
}
Interactive Demo
Syntax
<shape> = rect( <top>, <right>, <bottom>, <left> ) where each value is a <length> or auto
Values
- <top>The distance of the top edge of the visible area from the top of the border box, or auto (0).
- <right>The distance of the right edge from the left of the border box, or auto (the full width).
- <bottom>The distance of the bottom edge from the top of the border box, or auto (the full height).
- <left>The distance of the left edge from the left of the border box, or auto (0).
Example
Browser Support
The following information will show you the current browser support for the CSS shape data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
Desktop





Tablets & Mobile





