CSS clip Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Visual Effects

What You’ll Learn

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.

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().

📝 Syntax

The clip property uses the rect() function to define the clipping rectangle:

syntax.css
selector {
  clip: rect(top, right, bottom, left);
}

Basic Example

clip-rect.css
.clipped {
  position: absolute;
  clip: rect(50px, 200px, 150px, 50px);
}

Syntax Rules

  • The initial value is auto (no clipping).
  • 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.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toAbsolutely positioned elements
InheritedNo
AnimatableNo (in most cases)
Common useSimple rectangular cropping on positioned content

💎 Property Values

The clip property accepts auto or a rect() function with four edge values.

ValueExampleMeaning
autoclip: auto;No clipping is applied, and the element is fully visible.
toprect(50px, …)The top edge of the clipping rectangle.
rightrect(…, 200px, …)The right edge of the clipping rectangle.
bottomrect(…, 150px, …)The bottom edge of the clipping rectangle.
leftrect(…, 50px)The left edge of the clipping rectangle.
auto rect(top, right, bottom, left)

Understanding rect()

The four values inside rect() define a rectangle measured from the top-left of the element’s border box:

  1. top — distance from the top edge to the top of the visible region.
  2. right — distance from the left edge to the right side of the visible region.
  3. bottom — distance from the top edge to the bottom of the visible region.
  4. 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.

clip vs clip-path

Featureclipclip-path
Shape supportRectangles only (rect())Circles, ellipses, polygons, paths, and more
Position requirementAbsolutely positioned elements onlyWorks on most elements
StatusDeprecated; legacy supportModern, recommended for new work
Best forReading legacy code, simple rectangular cropsCreative shapes, animations, modern UI effects

👀 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(...)

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.

clip-image.html
<style>
  .clipped {
    position: absolute;
    clip: rect(50px, 200px, 150px, 50px);
  }
</style>

<div style="position: relative;">
  <img src="photo.jpg" alt="Example" class="clipped">
</div>
Try It Yourself

How It Works

Only the region inside the rectangle defined by rect(50px, 200px, 150px, 50px) stays visible; the rest of the image is hidden.

Example 2 — Clipped Text Block

Apply clip to a positioned paragraph to reveal only part of the text area.

clip-text.html
<style>
  .snippet {
    position: absolute;
    width: 240px;
    clip: rect(0px, 240px, 60px, 0px);
  }
</style>

<div style="position: relative; height: 70px;">
  <p class="snippet">Long text that gets clipped...</p>
</div>
Try It Yourself

How It Works

The clip rectangle limits the visible height of the paragraph to the first portion of text.

🔍 auto vs rect()

See how the default auto value differs from an active clipping region.

Example 3 — clip: auto (No Clipping)

With clip: auto, the full element remains visible — the default behavior.

clip-auto.css
.full-view {
  position: absolute;
  clip: auto;
}

.cropped {
  position: absolute;
  clip: rect(10px, 90px, 70px, 10px);
}
Try It Yourself

How It Works

auto disables clipping. Any rect() value creates a visible window inside the element.

Example 4 — Banner Crop with rect()

Crop a wide banner to show only a centered section — a common rectangular clip use case.

clip-banner.html
<style>
  .banner-wrap { position: relative; height: 80px; }
  .banner {
    position: absolute;
    width: 320px;
    height: 120px;
    clip: rect(20px, 280px, 80px, 40px);
    background: linear-gradient(90deg, #0ea5e9, #6366f1);
  }
</style>

<div class="banner-wrap">
  <div class="banner"></div>
</div>
Try It Yourself

How It Works

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.

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 Chrome All versions · Desktop & Mobile
Supported
Mozilla Firefox All versions · Desktop & Mobile
Supported
Apple Safari All versions · macOS & iOS
Supported
Microsoft Edge All versions
Supported
Opera All modern versions
Supported
clip property 95% supported (legacy)

Bottom line: clip works for legacy rectangular cropping. Prefer clip-path for new projects that need circles, polygons, or animations.

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.

💡 Best Practices

✅ Do

  • 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

Key Takeaways

Knowledge Unlocked

Five things to remember about clip

Use these points when working with rectangular clipping.

5
Core concepts
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.

Practice in the Live Editor

Open the HTML editor, add position: absolute and clip: rect(...), and preview the crop instantly.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful