YogeshChauhan . com

clip and clip-path properties in CSS

in CSS on March 27, 2021

clip CSS property (deprecated)

We can use clip property to show only a portion of any element for e.g. an image.

We can apply clip property only to elements with position property set to fixed or absolute.

We can clip the element in the shape of a rectangle using rect(top corner, right corner, bottom corner, left corner).

We can not clip element if the overflow property has been set as visible as its like telling browsers to do two completely opposite things.

The clip property still works but it won’t work forever. Try to use clip-path property instead.

clip-path CSS property

clip-path property is a newer and better version of clip.

With the clip-path property we can clip/show different shaped regions, not just a rectangle.

The biggest advantage of clip-path property is that it works really well with svg elements which just boost our imagination.

clip-path CSS property Examples

clip-path-circle-50

clip-path: circle(40%)

clip-path:ellipse

clip-path:polygon

Checkout some really good SVG clip-path examples on MDN.

amazon

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 How to Use SQL MAX() Function with Dates? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

Jun 16 What are Stored Procedures for SQL Server? Jun 16 What are Class Constants in PHP? Jun 15 A short basic guide on states in React Jun 15 How to define constants in PHP? Jun 15 How to define visibility for a property in PHP? Jun 15 How to use @if and @else in SCSS?

You might also like these

How to retrieve homepage URL in WordPress?WordPressList of social media icon logo color codes in HEXMiscList of all Pseudo Elements in CSSCSSPre-defined DatePipe format options in Angular 9AngularHow to convert datetime to date format in JavaScript?JavaScriptHow to convert a function component into a class in React?ReactHow to add a Pie Chart in Angular App?AngularWhat is ECMAScript?JavaScriptALTER DATABASE in PostgreSQLPostgresWhat’s a Log File and What are Log File Monitors?Misc5 Ways to Loop Through JavaScript ArraysJavaScriptCheck if any column has NULL values in PostgresPostgres