{"id":20802,"date":"2015-02-03T12:34:52","date_gmt":"2015-02-03T11:34:52","guid":{"rendered":"http:\/\/tympanus.net\/codrops\/?post_type=css_reference&#038;p=20802"},"modified":"2020-02-07T07:05:21","modified_gmt":"2020-02-07T07:05:21","slug":"clip-path","status":"publish","type":"css_reference","link":"https:\/\/tympanus.net\/codrops\/css_reference\/clip-path\/","title":{"rendered":"clip-path"},"content":{"rendered":"<div class=\"ct-cssref-description\">\n<p>                    The <code class=\"\" data-line=\"\">clip-path<\/code> property is used to specify a basic shape (<a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/basic-shape\"><code class=\"\" data-line=\"\">&lt;basic-shape&gt;<\/code><\/a>) or reference an SVG path (<a href=\"http:\/\/www.w3.org\/TR\/2014\/WD-css-masking-1-20140213\/#elementdef-clippath\"><code class=\"\" data-line=\"\">&lt;clipPath&gt;<\/code><\/a>) to be  used as a <em><strong>clipping path<\/strong><\/em> on the element.<\/p>\n<p>The element can be an HTML element or an SVG element. (See Syntax and Values sections.)<\/p>\n<h3>Concepts and Terminology<\/h3>\n<h4>What is &#8220;clipping&#8221;?<\/h4>\n<p>Clipping is a graphical operation that allows you to fully or partially hide portions of an element. The portions of the element that are shown or hidden are determined by a <em>clipping path<\/em>.<\/p>\n<h4>Clipping Paths &amp; Regions<\/h4>\n<p>A <strong>clipping path<\/strong> can be either a basic shape or a vector path. This path defines a region (in the absence of anti-aliasing) where everything on the &#8220;inside&#8221; of this region is allowed to show through but everything on the outside is &#8220;clipped out&#8221; and does not appear on the canvas. This region is known as the <em><strong>clipping region<\/strong><\/em>.<\/p>\n<p>Conceptually, any parts of the element that lie outside of a clipping region are not drawn. This includes any content, background, borders, text decoration, outline and visible scrolling mechanism of the element to which the clipping path is applied, and those of its descendants.<\/p>\n<figure id=\"attachment_20803\" aria-describedby=\"figcaption_attachment_20803\" class=\"wp-caption alignnone\" itemscope itemtype=\"http:\/\/schema.org\/ImageObject\" style=\"width: 661px\"><img loading=\"lazy\" decoding=\"async\" itemprop=\"contentURL\" src=\"http:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/clipping-path.png\" alt=\"clipping-path\" width=\"661\" height=\"252\" class=\"size-full wp-image-20803\" srcset=\"https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/clipping-path.png 661w, https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/clipping-path-300x114.png 300w\" sizes=\"auto, (max-width: 661px) 100vw, 661px\" \/><figcaption id=\"figcaption_attachment_20803\" class=\"wp-caption-text\" itemprop=\"description\">A clipping path (middle) is applied on a polygon shaded with different colors (left). This results in a &#8220;clipped out&#8221; shape (right). (<a href=\"http:\/\/www.w3.org\/TR\/2014\/WD-css-masking-1-20140213\/#clipping\">Source<\/a>)<\/figcaption><\/figure>\n<p>A clipping path is conceptually equivalent to a custom viewport for the element it applies to. Thus, it affects the rendering of an element. It does not affect the element&#8217;s inherent geometry. The boundaries of a clipped element must remain the same as if it were not clipped. The element will affect the flow around it as it normally would, and every other element on the page will still see and treat the element as if it were still rectangular, even if it&#8217;s clipped to a non-rectangular shape. If you want to change the way the content around the element flows and have it respond to the defined shape of the clip path, you can use the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> property.<\/p>\n<p>If the clipping region exceeds the bounds of the user agent&#8217;s document window, content may be clipped to that window by the native operating environment.<\/p>\n<p>An element&#8217;s ancestors may also clip portions of their content (e.g., via their own <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/clip\"><code class=\"\" data-line=\"\">clip<\/code><\/a> or <code class=\"\" data-line=\"\">clip-path<\/code> properties and\/or if their <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/overflow\"><code class=\"\" data-line=\"\">overflow<\/code><\/a> property is not <code class=\"\" data-line=\"\">visible<\/code>). What is rendered is the cumulative intersection.<\/p>\n<h4>Clipping Regions and Pointer Events<\/h4>\n<p>The <code class=\"\" data-line=\"\">clip-path<\/code> property should restrict the areas of the element that accept pointer events to the clip path it defines\/references. Pointer events must not be dispatched on the clipped (non-visible) regions of a shape.<br \/>\nThis means that the element should not respond to pointer events like hover or click events even if it is hovered or clicked outside its visible region.<\/p>\n<h3>Animating Clipping Paths<\/h3>\n<p>Clipping paths defined using basic shapes can be animated just like shapes defined for the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> property can.<\/p>\n<p>In short, a clipping path can be animated from one shape to another because it is made up of points. These points have coordinates that are either length or percentage values. And since lengths and percentages are animatable, shapes can be animated as well. So, basically, you&#8217;re animating the position of the points that make up a shape.<\/p>\n<p>However, note that you can animate one shape into another only by using the same shape function for the initial and final shape, because the initial and final shape must have the same number of points, otherwise the animation is not possible.<\/p>\n<p>For more information please see the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> property entry.<\/p>\n<h2>Trivia &amp; Notes<\/h2>\n<h4>The deprecated <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/clip\"><code class=\"\" data-line=\"\">clip<\/code><\/a> Property<\/h4>\n<p>Before the <code class=\"\" data-line=\"\">clip-path<\/code> property was introduced, in CSS 2.1, the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/clip\"><code class=\"\" data-line=\"\">clip<\/code><\/a> property was used to clip parts of an element, similar to the way <code class=\"\" data-line=\"\">clip-path<\/code> works.<\/p>\n<p>However, the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/clip\"><code class=\"\" data-line=\"\">clip<\/code><\/a> property was very limited: the only supported clipping shape was a rectangle shape created using the <code class=\"\" data-line=\"\">rect()<\/code> function.<\/p>\n<p>Moreover, <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/clip\"><code class=\"\" data-line=\"\">clip<\/code><\/a> only worked on absolutely-positioned element, which limites its use a lot. Even in SVG, it was limited to specific elements as well.<\/p>\n<p>These reasons, among others, are why the <code class=\"\" data-line=\"\">clip-path<\/code> property was added to the SVG specification and then adapted by the CSS Masking module today.<\/p>\n<p>If you&#8217;re interested, you can read more about the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/clip\"><code class=\"\" data-line=\"\">clip<\/code><\/a> property in its entry.<\/p>\n<h4>Using <code class=\"\" data-line=\"\">clip-path<\/code> with CSS Shapes<\/h4>\n<p>The <code class=\"\" data-line=\"\">clip-path<\/code> property is a great companion to the CSS Shapes properties, particularly the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> property.<\/p>\n<p>Using <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> you can change the way content flows around an element because the shape applied using <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> changes the geometry of the element&#8217;s float area. However, the shape does not change anything else about the element, like backgrounds and borders and such.  This means that any borders and background images will not adapt to the shape created on the element. So, even though the element&#8217;s float area changes, the content around the element may end up being on top of the element&#8217;s background image.<\/p>\n<figure id=\"attachment_20804\" aria-describedby=\"figcaption_attachment_20804\" class=\"wp-caption alignnone\" itemscope itemtype=\"http:\/\/schema.org\/ImageObject\" style=\"width: 890px\"><img loading=\"lazy\" decoding=\"async\" itemprop=\"contentURL\" src=\"http:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/text-over-shape.jpg\" alt=\"text-over-shape\" width=\"890\" height=\"450\" class=\"size-full wp-image-20804\" srcset=\"https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/text-over-shape.jpg 890w, https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/text-over-shape-300x151.jpg 300w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><figcaption id=\"figcaption_attachment_20804\" class=\"wp-caption-text\" itemprop=\"description\">An example showing the result of changing the float area of an element using the <code class=\"\" data-line=\"\">shape-outside<\/code> property. The background area of the element remains unchanged, resulting in the text overlapping it and therefore getting an unwanted result.<\/figcaption><\/figure>\n<p>In order &#8220;clip&#8221; the background of the element to match the defined shape, you can use the <code class=\"\" data-line=\"\">clip-path<\/code> property. All you have to do is pass in the same shape function that you used in the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> property to the <code class=\"\" data-line=\"\">clip-path<\/code> property, and the element&#8217;s background image will then be clipped to the defined shape, resulting in a more defined shape altogether.<\/p>\n<figure id=\"attachment_20805\" aria-describedby=\"figcaption_attachment_20805\" class=\"wp-caption alignnone\" itemscope itemtype=\"http:\/\/schema.org\/ImageObject\" style=\"width: 890px\"><img loading=\"lazy\" decoding=\"async\" itemprop=\"contentURL\" src=\"http:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/shape-clipped.jpg\" alt=\"shape-clipped\" width=\"890\" height=\"452\" class=\"size-full wp-image-20805\" srcset=\"https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/shape-clipped.jpg 890w, https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/shape-clipped-300x152.jpg 300w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><figcaption id=\"figcaption_attachment_20805\" class=\"wp-caption-text\" itemprop=\"description\">The result of using the <code class=\"\" data-line=\"\">clip-path<\/code> property to visually define a CSS Shape applied using <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a>.<\/figcaption><\/figure>\n<p>You can read more about CSS Shapes and using <code class=\"\" data-line=\"\">clip-path<\/code> with them in the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> property entry, and see the above demo live in the Examples section below.<\/p>\n<\/div>\n<div class=\"ct-cssref-info\">\n<h2>Official Syntax<\/h2>\n<ul>\n<li>\n                       <strong>Syntax: <\/strong><\/p>\n<pre class=\"brush:css\">clip-path: &lt;clip-source&gt; | [ &lt;basic-shape&gt; || &lt;geometry-box&gt; ] | none\n\n\/* where *\/\n&lt;clip-source&gt; = &lt;url&gt; \/* URL references an SVG &lt;clipPath&gt; element  *\/\n\n\/* and *\/\n&lt;geometry-box&gt; = &lt;shape-box&gt; | fill | stroke | view-box\n<\/pre>\n<\/li>\n<li>\n                        <strong>Initial: <\/strong> none<\/li>\n<li>\n                       <strong>Applies To: <\/strong> All elements. In SVG, it applies to container elements without the &lt;defs&gt; element and all graphics elements<\/li>\n<li>\n                        <strong>Animatable: <\/strong> See <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a><\/li>\n<\/ul>\n<h3>Notes<\/h3>\n<p>The <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/basic-shape\"><code class=\"\" data-line=\"\">&lt;basic-shape&gt;<\/code><\/a> is a shape created using the basic shape functions. See the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/basic-shape\"><code class=\"\" data-line=\"\">&lt;basic-shape&gt;<\/code><\/a> entry for details.<\/p>\n<p>The <code class=\"\" data-line=\"\">&lt;geometry-box&gt;<\/code> can be either a <code class=\"\" data-line=\"\">&lt;shape-box&gt;<\/code> or one of the three keywords: <code class=\"\" data-line=\"\">fill<\/code>, <code class=\"\" data-line=\"\">stroke<\/code>, <code class=\"\" data-line=\"\">view-box<\/code>.<\/p>\n<p>The <code class=\"\" data-line=\"\">&lt;shape-box&gt;<\/code> defines the reference box for the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/basic-shape\"><code class=\"\" data-line=\"\">&lt;basic-shape&gt;<\/code><\/a>s created using the shape functions. It can be one of the following values: <code class=\"\" data-line=\"\">margin-box<\/code>, <code class=\"\" data-line=\"\">border-box<\/code>, <code class=\"\" data-line=\"\">padding-box<\/code>, <code class=\"\" data-line=\"\">content-box<\/code>. These boxes are applied and can be used on HTML elements.<\/p>\n<p>The other three geometry box values are applied to SVG elements. SVG elements don&#8217;t have a box model, and so the <code class=\"\" data-line=\"\">&lt;shape-box&lt;<\/code> values will have no effect on them. As a matter of fact, the <code class=\"\" data-line=\"\">&lt;shape-box&gt;<\/code> values will resolve to the value <code class=\"\" data-line=\"\">fill<\/code>.<\/p>\n<p>On the other hand, the SVG geometry box values will resolve to <code class=\"\" data-line=\"\">border-box<\/code> when used on an HTML element.<\/p>\n<\/div>\n<div class=\"ct-cssref-values\">\n<h2>Values<\/h2>\n<dl>\n<dt>&lt;clip-source&gt;<\/dt>\n<dd>\n                        A <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/url_value\"><code class=\"\" data-line=\"\">&lt;url&gt;<\/code><\/a> pointing to an SVG <code class=\"\" data-line=\"\">clipPath<\/code> element that is to be used as a clipping path.<\/dd>\n<dt>&lt;basic-shape&gt;<\/dt>\n<dd>\n                        A basic shape function as defined in the CSS Shapes module (See the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> property entry). A basic shape makes use of the specified reference box to size and position the basic shape. If no reference box is specified, the <code class=\"\" data-line=\"\">border-box<\/code> will be used as reference box.<\/dd>\n<dt>&lt;geometry-box&gt;<\/dt>\n<dd>\n                        Can be either a <code class=\"\" data-line=\"\">&lt;shape-box&gt;<\/code> or <code class=\"\" data-line=\"\">fill<\/code>, <code class=\"\" data-line=\"\">stroke<\/code>, or <code class=\"\" data-line=\"\">view-box<\/code>.<\/p>\n<p>A <code class=\"\" data-line=\"\">&lt;shape-box&gt;<\/code> is applied to an HTML element and can be one of four possible box values: <code class=\"\" data-line=\"\">margin-box<\/code>, <code class=\"\" data-line=\"\">border-box<\/code>, <code class=\"\" data-line=\"\">padding-box<\/code>, and <code class=\"\" data-line=\"\">content-box<\/code>.<\/p>\n<p>If specified in combination with a <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/basic-shape\"><code class=\"\" data-line=\"\">&lt;basic-shape&gt;<\/code><\/a> it provides the <strong>reference box<\/strong> for the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/basic-shape\"><code class=\"\" data-line=\"\">&lt;basic-shape&gt;<\/code><\/a>. (See the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> property entry for details and more information.)<\/p>\n<p>If specified by itself, uses the edges of the specified box as a reference box, including any corner shaping (e.g. defined by <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/border-radius\"><code class=\"\" data-line=\"\">border-radius<\/code><\/a>), as a clipping path.<\/p>\n<p>In addition to the <code class=\"\" data-line=\"\">&lt;shape-box&gt;<\/code> values, the other three values can be applied to SVG elements and have the following meanings:<\/p>\n<ul>\n<li><code class=\"\" data-line=\"\">fill<\/code> uses the object bounding box as reference box.<\/li>\n<li><code class=\"\" data-line=\"\">Stroke<\/code> uses the stroke bounding box as reference box.<\/li>\n<li><code class=\"\" data-line=\"\">view-box<\/code> uses the nearest SVG viewport as reference box.<br \/>\nIf a <code class=\"\" data-line=\"\">viewBox<\/code> attribute is specified for the SVG viewport creating element, the reference box is positioned at the origin of the coordinate system established by the <code class=\"\" data-line=\"\">viewBox<\/code> attribute, and the dimension of the reference box is set to the <em>width<\/em> and <em>height<\/em> values of the <code class=\"\" data-line=\"\">viewBox<\/code> attribute.<\/li>\n<\/ul>\n<p>For SVG elements without associated CSS layout box, the values <code class=\"\" data-line=\"\">content-box<\/code>, <code class=\"\" data-line=\"\">padding-box<\/code>, <code class=\"\" data-line=\"\">border-box<\/code> and <code class=\"\" data-line=\"\">margin-box<\/code> compute to <code class=\"\" data-line=\"\">fill<\/code>.<\/p>\n<p>For elements with associated CSS layout box, the values <code class=\"\" data-line=\"\">fill<\/code>, <code class=\"\" data-line=\"\">stroke<\/code> and <code class=\"\" data-line=\"\">view-box<\/code> compute to <code class=\"\" data-line=\"\">border-box<\/code>.<\/dd>\n<dt>none<\/dt>\n<dd>\n                        No clipping path gets created.<\/dd>\n<\/dl>\n<h3>Notes<\/h3>\n<p><strong>A computed value of other than none results in the creation of a <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/z-index\">stacking context<\/a> the same way that CSS <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/opacity\"><code class=\"\" data-line=\"\">opacity<\/code><\/a> property does.<\/strong><\/p>\n<p>If the URI reference is not valid (e.g it points to an object that doesn\u2019t exist or the object is not a <code class=\"\" data-line=\"\">clipPath<\/code> element), no clipping is applied.<\/p>\n<\/div>\n<div class=\"ct-cssref-examples\">\n<h2>Examples<\/h2>\n<p>The following are examples of using the basic shape functions with the <code class=\"\" data-line=\"\">clip-path<\/code> property:<\/p>\n<pre class=\"brush:css\">clip-path: polygon(15px 99px, 30px 87px, 65px 99px, 85px 55px, 122px 57px, 184px 73px, 198px 105px, 199px 150px, 145px 159px, 155px 139px, 126px 120px, 112px 138px, 80px 128px, 39px 126px, 24px 104px);\nclip-path: circle(70% at 0% 50%) padding-box;\nclip-path: inset(10px 20px 30px 40px round 10px) margin-box;\nclip-path: ellipse(farthest-side closest-side at 25% 25%);\n<\/pre>\n<p>The following is a live demo of the above example using the <code class=\"\" data-line=\"\">clip-path<\/code> property in conjunction with the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/shape-outside\"><code class=\"\" data-line=\"\">shape-outside<\/code><\/a> property. The code looks like the following:<\/p>\n<pre class=\"brush:css\">.element {\n    \/* use the same shape in both properties *\/\n    clip-path: circle(70% at 0% 50%);\n    \/* set the reference box of the Shape to be the same as the clip-path's for this example *\/\n    shape-outside: circle(70% at 0% 50%) border-box;\n}\n<\/pre>\n<p style='font-style:italic;padding: 2rem 0;'>\n    Example demos are temporarily unavailable. Please check back soon.\n  <\/p>\n<p>The following example uses an SVG path as a clipping path:<\/p>\n<pre class=\"brush:css\">.element {\n    \/* ... *\/\n    clip-path: url(#svgClipPathID);\n}\n<\/pre>\n<p>The SVG in this example is embedded in the document:<\/p>\n<pre class=\"brush:css\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n    &lt;body&gt;\n        &lt;!-- ... --&gt;\n        &lt;svg&gt;\n            &lt;defs&gt;\n                &lt;clipPath id=\"thePath\" clipPathUnits=\"objectBoundingBox\"&gt;\n                    &lt;polygon fill=\"none\" stroke=\"#000\" stroke-miterlimit=\"10\" points=\".3,0 .5,.3 .7,0 .8,.4 1,.8 .5,.7 .4,.9 0,.6\"\/&gt;\n                &lt;\/clipPath&gt;\n            &lt;\/defs&gt;\n        &lt;\/svg&gt;\n    &lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre>\n<p>The result of applying the above path to an image would look like the following:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/svg-clip-path.jpg\" alt=\"svg-clip-path\" width=\"730\" height=\"558\" class=\"alignnone size-full wp-image-20806\" srcset=\"https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/svg-clip-path.jpg 730w, https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/svg-clip-path-300x229.jpg 300w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/p>\n<p>The following is a live demo of the above example. Note that the demo may or may not work in your browser. Please see the note on browser compatibility below for more information.<\/p>\n<p style='font-style:italic;padding: 2rem 0;'>\n    Example demos are temporarily unavailable. Please check back soon.\n  <\/p>\n<h3>Notes: Tool For Clip-Path<\/h3>\n<p>The following is a screenshot of <a href=\"http:\/\/cssplant.com\/clip-path-generator\">a nice tool by CSSPlant<\/a> that allows you to visually create a clip path for the <code class=\"\" data-line=\"\">clip-path<\/code> property. The tool then generates the code for a <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/basic-shape#section_polyon\"><code class=\"\" data-line=\"\">polygon()<\/code><\/a> function which you can then directly use as a value for <code class=\"\" data-line=\"\">clip-path<\/code>.<\/p>\n<figure id=\"attachment_20807\" aria-describedby=\"figcaption_attachment_20807\" class=\"wp-caption alignnone\" itemscope itemtype=\"http:\/\/schema.org\/ImageObject\" style=\"width: 890px\"><img loading=\"lazy\" decoding=\"async\" itemprop=\"contentURL\" src=\"http:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/clip-path-generator.jpg\" alt=\"clip-path-generator\" width=\"890\" height=\"517\" class=\"size-full wp-image-20807\" srcset=\"https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/clip-path-generator.jpg 890w, https:\/\/tympanus.net\/codrops\/wp-content\/uploads\/2014\/10\/clip-path-generator-300x174.jpg 300w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><figcaption id=\"figcaption_attachment_20807\" class=\"wp-caption-text\" itemprop=\"description\">Screenshot of the clip-path generator by CSSPlant.<\/figcaption><\/figure>\n<p>The clip path generator can be very useful and time-saving, so make sure to check it out!<\/p>\n<\/div>\n<div class=\"ct-cssref-demo\">\n<h2>Live Demo<\/h2>\n<p>The following demo uses the <a href=\"http:\/\/tympanus.net\/codrops\/css_reference\/basic-shape#section_polyon\"><code class=\"\" data-line=\"\">polygon()<\/code><\/a> function to clip an element using <code class=\"\" data-line=\"\">clip-path<\/code>. The element has a scroll bar that is only partially visible because it lies almost completely outside the clipping region defined by the clip path.<\/p>\n<p>Moreover, the polygonal clip path is animated. It animates into another shape when you hover over the element.<\/p>\n<p>Try changing the values of the clip path and\/or removing it to see how the element looks like in all cases.<\/p>\n<p style='font-style:italic;padding: 2rem 0;'>\n    Example demos are temporarily unavailable. Please check back soon.\n  <\/p>\n<\/div>\n<div class=\"ct-cssref-support\">\n<h2>Browser Support<\/h2>\n<div class=\"caniuse\"><div class=\"caniuse-header\"><h3 class=\"caniuse-header-title\">CSS clip-path property (for HTML)<\/h3><p>Method of defining the visible region of an HTML element using SVG or a shape definition.<\/p>\n<p class=\"status caniuse-header-status\">W3C Candidate Recommendation<\/p><p class=\"caniuse-header-supported\">Supported from the following versions:<\/p><\/div><div class=\"caniuse-section\"><h4>Desktop<\/h4><ul class=\"agents caniuse-agents-list\"><li class=\"caniuse-agents-item icon-chrome a\" title=\"Google Chrome - Partial Support\"><span class=\"caniuse-agents-version version\">55<\/span><\/li><li class=\"caniuse-agents-item icon-firefox y\" title=\"Mozilla Firefox - Yes\"><span class=\"caniuse-agents-version version\">54<\/span><\/li><li class=\"caniuse-agents-item icon-ie n\" title=\"Internet Explorer - No\"><span class=\"caniuse-agents-version version\">No<\/span><\/li><li class=\"caniuse-agents-item icon-opera a\" title=\"Opera - Partial Support\"><span class=\"caniuse-agents-version version\">42<\/span><\/li><li class=\"caniuse-agents-item icon-safari a\" title=\"Apple Safari - Partial Support\"><span class=\"caniuse-agents-version version\">13<\/span><\/li><\/ul><\/div><div class=\"caniuse-section\"><h4>Mobile \/ Tablet<\/h4><ul class=\"agents caniuse-agents-list\"><li class=\"caniuse-agents-item icon-ios_saf a\" title=\"iOS Safari - Partial Support\"><span class=\"caniuse-agents-version version\">13<\/span><\/li><li class=\"caniuse-agents-item icon-android a\" title=\"Android - Partial Support\"><span class=\"caniuse-agents-version version\">147<\/span><\/li><li class=\"caniuse-agents-item icon-op_mini n\" title=\"Opera Mini - No\"><span class=\"caniuse-agents-version version\">No<\/span><\/li><li class=\"caniuse-agents-item icon-and_chr a\" title=\"Android Chrome - Partial Support\"><span class=\"caniuse-agents-version version\">147<\/span><\/li><li class=\"caniuse-agents-item icon-and_ff y\" title=\"Android Firefox - Yes\"><span class=\"caniuse-agents-version version\">149<\/span><\/li><\/ul><\/div><div class=\"caniuse-section caniuse-section-legend\"><p class=\"caniuse-section-text caniuse-section-subtext\t\">* denotes prefix required.<\/p><ul class=\"legend caniuse-legend-list\"><li class=\"caniuse-legend-item caniuse-legend-label\">Supported:<\/li><li class=\"caniuse-legend-item y\">Yes<\/li><li class=\"caniuse-legend-item n\">No<\/li><li class=\"caniuse-legend-item a\">Partially<\/li><li class=\"caniuse-legend-item p\">Polyfill<\/li><\/ul><p class=\"stats caniuse-section-text caniuse-section-stats\">Stats from <a target=\"_blank\" href=\"http:\/\/caniuse.com\/#feat=css-clip-path\">caniuse.com<\/a><\/p><\/div><\/div>\n<h3>Notes<\/h3>\n<p>This module, as you can see in the support table above, hasn&#8217;t been fully implemented in all browsers, so you&#8217;re probably not going to be able to use all features even in browsers that have implemented certain properties (for the time being). In Canary, for example, the <code class=\"\" data-line=\"\">clip-path<\/code> property accepts a shape box to specify its reference box, but that&#8217;s not yet implemented in the stable channel of Chrome.<\/p>\n<p>In the meantime, you can check out this open source <a href=\"https:\/\/github.com\/awgreenblatt\/css-graphics\">feature support table<\/a> by Alan Greenblatt on GitHub. The purpose of this table is to provide some insight into what the current state of affairs is with various browser implementations of CSS Clipping and Masking features.<\/p>\n<\/div>\n<div class=\"ct-cssref-further-reading\">\n<h2>Further Reading<\/h2>\n<ul>\n<li>\n                       <a href=\"http:\/\/www.w3.org\/TR\/2014\/WD-css-masking-1-20140213\/#propdef-clip-path\">CSS Masking Module Level 1<\/a><\/li>\n<li>\n                        <a href=\"http:\/\/sarasoueidan.com\/blog\/css-svg-clipping\">Clipping in CSS &amp; SVG \u2013 The <code class=\"\" data-line=\"\">clip-path<\/code> Property &amp; <code class=\"\" data-line=\"\">clipPath<\/code> Element<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"author":67,"menu_order":0,"template":"","format":"standard","class_list":["post-20802","css_reference","type-css_reference","status-publish","format-standard","hentry","css-type-css-property"],"acf":[],"_links":{"self":[{"href":"https:\/\/tympanus.net\/codrops\/wp-json\/wp\/v2\/css_reference\/20802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tympanus.net\/codrops\/wp-json\/wp\/v2\/css_reference"}],"about":[{"href":"https:\/\/tympanus.net\/codrops\/wp-json\/wp\/v2\/types\/css_reference"}],"author":[{"embeddable":true,"href":"https:\/\/tympanus.net\/codrops\/wp-json\/wp\/v2\/users\/67"}],"version-history":[{"count":0,"href":"https:\/\/tympanus.net\/codrops\/wp-json\/wp\/v2\/css_reference\/20802\/revisions"}],"wp:attachment":[{"href":"https:\/\/tympanus.net\/codrops\/wp-json\/wp\/v2\/media?parent=20802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}