The clip property defines a rectangular visible area for positioned elements. It hides everything outside that rectangle — useful for simple cropping effects and understanding legacy CSS.
01
Clipping
Show part of an element.
02
rect()
Rectangle function.
03
auto Default
No clipping applied.
04
Positioned
Requires absolute/fixed.
05
clip-path
Modern alternative.
06
Legacy
Still in browsers.
Fundamentals
Definition and Usage
The clip CSS property defines a visible portion of an element. It works with positioned elements, allowing you to specify a rectangular area through which the content is displayed while hiding the rest.
Although largely replaced by the clip-path property, clip is still useful for certain tasks and remains supported in modern browsers. It is best suited when you need a simple rectangular crop on an absolutely positioned element.
💡
Beginner Tip
For new projects, prefer clip-path for flexible shapes. Learn clip to understand older code and simple rectangular clipping with rect().
Foundation
📝 Syntax
The clip property uses the rect() function to define the clipping rectangle:
rect(top, right, bottom, left) defines edges relative to the element’s border box.
The element must have position: absolute or position: fixed.
Values are typically lengths (px, em) or auto for each edge.
For complex shapes, use clip-path instead of clip.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
auto
Applies to
Absolutely positioned elements
Inherited
No
Animatable
No (in most cases)
Common use
Simple rectangular cropping on positioned content
Reference
💎 Property Values
The clip property accepts auto or a rect() function with four edge values.
Value
Example
Meaning
auto
clip: auto;
No clipping is applied, and the element is fully visible.
top
rect(50px, …)
The top edge of the clipping rectangle.
right
rect(…, 200px, …)
The right edge of the clipping rectangle.
bottom
rect(…, 150px, …)
The bottom edge of the clipping rectangle.
left
rect(…, 50px)
The left edge of the clipping rectangle.
autorect(top, right, bottom, left)
Deep Dive
Understanding rect()
The four values inside rect() define a rectangle measured from the top-left of the element’s border box:
top — distance from the top edge to the top of the visible region.
right — distance from the left edge to the right side of the visible region.
bottom — distance from the top edge to the bottom of the visible region.
left — distance from the left edge to the left side of the visible region.
Anything outside this rectangle is clipped (hidden). Wrap the element in a position: relative container when you need to control layout around the clipped content.
Compare
clip vs clip-path
Feature
clip
clip-path
Shape support
Rectangles only (rect())
Circles, ellipses, polygons, paths, and more
Position requirement
Absolutely positioned elements only
Works on most elements
Status
Deprecated; legacy support
Modern, recommended for new work
Best for
Reading legacy code, simple rectangular crops
Creative shapes, animations, modern UI effects
Preview
👀 Live Preview
A gradient block is clipped with rect(24px, 176px, 112px, 40px) inside a positioned container. Only the center portion remains visible.
The dashed border shows the container; the colorful rectangle is the clipped result.
clip: auto
clip: rect(...)
Hands-On
Examples Gallery
Try rectangular clipping on images, text blocks, auto vs clipped comparison, and a positioned banner crop.
✂ Basic Clipping
Start with the reference example — an absolutely positioned element clipped with rect().
Example 1 — Image Clipped with rect()
Clip an image to show only a portion of it inside a positioned container.
The wrapper sets layout height while the inner banner is cropped to show a horizontal slice of the gradient.
🧠 How clip Works
1
Element is positioned
Set position: absolute or fixed so the clip property can apply.
Prerequisite
2
You define rect() edges
Specify top, right, bottom, and left values to create a rectangular visible region.
CSS rule
3
Browser hides outside area
Content outside the rectangle is not painted — only the interior region appears on screen.
Rendering
=
✂
Rectangular crop effect
The element displays only the chosen rectangular portion — everything else is clipped away.
Compatibility
Browser Support
The clip property is supported in most modern browsers. For more complex clipping paths, consider using clip-path, which offers greater flexibility and control.
✓ Legacy · Still supported
Rectangular clipping in modern browsers
Chrome, Firefox, Safari, Edge, and Opera support clip on positioned elements for legacy rectangular cropping.
95%Browser support
Google ChromeAll versions · Desktop & Mobile
Supported
Mozilla FirefoxAll versions · Desktop & Mobile
Supported
Apple SafariAll versions · macOS & iOS
Supported
Microsoft EdgeAll versions
Supported
OperaAll modern versions
Supported
clip property95% supported (legacy)
Bottom line:clip works for legacy rectangular cropping. Prefer clip-path for new projects that need circles, polygons, or animations.
Wrap Up
Conclusion
The clip property is a handy tool for defining the visible area of an element, particularly when a simple rectangular clipping region is sufficient. While its use cases are more limited compared to the more versatile clip-path property, it can still be useful in certain scenarios.
Experiment with different clipping regions to see how this property can be applied to your web projects — and reach for clip-path when you need shapes beyond a rectangle.
Set position: absolute or fixed before applying clip
Use a position: relative wrapper to control layout space
Prefer clip-path for new projects and complex shapes
Test clipped content for readability and accessibility
Use overflow: hidden when a simple box crop on non-positioned elements is enough
❌ Don’t
Apply clip without positioning the element first
Hide important text or controls with clipping — users cannot access clipped content
Choose clip over clip-path for circles or custom shapes
Forget that clip is deprecated in favor of modern alternatives
Rely on clipping alone for responsive layouts — consider object-fit or clip-path
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about clip
Use these points when working with rectangular clipping.
5
Core concepts
✂01
Rectangular crop
Visible region only.
Purpose
⚙02
auto Default
No clipping applied.
Default
📐03
rect()
Four edge values.
Syntax
📌04
Must position
absolute or fixed.
Rule
🛸05
Use clip-path
For modern shapes.
Modern
❓ Frequently Asked Questions
clip defines a rectangular visible region for an element. Content outside that rectangle is hidden. Only the area inside the clip region is displayed.
The initial value is auto, which means no clipping is applied and the entire element remains visible.
The clip property only applies to absolutely positioned elements. You typically set position: absolute (or fixed) before applying clip: rect(...).
clip only supports rectangular regions via rect() and is largely deprecated. clip-path supports circles, polygons, and complex shapes and is the modern choice for new projects.
For new work, prefer clip-path or overflow: hidden when a simple rectangle is enough. clip remains useful for understanding legacy code and simple rectangular clipping on positioned elements.