<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>https://web.dev/</id>
  <title>Razvan Caliman on web.dev</title>
  <updated>2026-04-15T23:21:06Z</updated>
  <author>
    <name>Razvan Caliman</name>
  </author>
  <link href="https://web.dev/authors/razvancaliman/feed.xml" rel="self"/>
  <link href="https://web.dev/"/>
  <icon>https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/7dpZJ4nTkOOGSpZdJqeR.png?auto=format</icon>
  <logo>https://web.dev/images/shared/rss-banner.png</logo>
  <subtitle>Web Platform Adobe</subtitle>
  
  
  <entry>
    <title>Getting Started with CSS Shapes</title>
    <link href="https://web.dev/shapes-getting-started/"/>
    <updated>2014-09-16T00:00:00Z</updated>
    <id>https://web.dev/shapes-getting-started/</id>
    <content type="html" mode="escaped">&lt;p&gt;For a long time, web designers have been forced to create within the constraints of the rectangle. Most content on the web is still trapped in simple boxes because most creative ventures into non-rectangular layout end in frustration. That is about to change with the introduction of CSS Shapes, available starting with Chrome 37.
CSS Shapes allow web designers to wrap content around custom paths, like circles, ellipses and polygons, thus breaking free from the constraints of the rectangle.&lt;/p&gt;
&lt;p&gt;Shapes can be defined manually or they can be inferred from images.&lt;/p&gt;
&lt;p&gt;Let&#39;s look at a very simple example.&lt;/p&gt;
&lt;p&gt;Perhaps you&#39;ve been as naïve as me when first floating an image with transparent parts expecting the content to wrap and fill the gaps, only to be disappointed by the rectangular wrap shape persisting around the element. CSS Shapes can be used to solve this problem.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt=&quot;Extracting a shape from an image&quot; decoding=&quot;async&quot; height=&quot;400&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/xi3LbvT89PfuyhpK4aHh.jpg?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;div&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;img&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;element&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;image.png&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Lorem ipsum…&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token style&quot;&gt;&lt;span class=&quot;token language-css&quot;&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token url&quot;&gt;&lt;span class=&quot;token function&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;image.png&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-image-threshold&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.5&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; left&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;style&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;The &lt;code&gt;shape-outside: url(image.png)&lt;/code&gt; CSS declaration tells the browser to extract a shape from the image.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;shape-image-threshold&lt;/code&gt; property defines the minimum opacity level of pixels that will be used to create the shape. Its value must be in the range between &lt;code&gt;0.0&lt;/code&gt; (fully transparent) and &lt;code&gt;1.0&lt;/code&gt; (fully opaque). So, &lt;code&gt;shape-image-threshold: 0.5&lt;/code&gt; means that only pixels with opacity 50% and above will be used to create the shape.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;float&lt;/code&gt; property is key here. While the &lt;code&gt;shape-outside&lt;/code&gt; property defines the shape of the area around which content will wrap, without the float, you won&#39;t see the effects of the shape.&lt;/p&gt;
&lt;p&gt;Elements have a float area on the opposite side of their &lt;code&gt;float&lt;/code&gt; value. For example, if an element with a coffee cup image is being floated left, the float area will be created to the right of the cup. Even though you can engineer an image with gaps on both sides, content will only wrap around the shape on the opposite side designated by the float property, left or right, never both.&lt;/p&gt;
&lt;p&gt;In the future, it will be possible to use &lt;code&gt;shape-outside&lt;/code&gt; on elements which are not floated with the introduction CSS Exclusions.&lt;/p&gt;
&lt;h2 id=&quot;creating-shapes-manually&quot;&gt;Creating shapes manually &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#creating-shapes-manually&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Beyond extracting shapes from images, you can also code them manually. You can choose from a few functional values to create shapes: &lt;code&gt;circle()&lt;/code&gt;, &lt;code&gt;ellipse()&lt;/code&gt;, &lt;code&gt;inset()&lt;/code&gt; and &lt;code&gt;polygon()&lt;/code&gt;. Each shape function accepts a set of coordinates and it is paired with a reference box which establishes the coordinate system. More about reference boxes in a moment.&lt;/p&gt;
&lt;h2 id=&quot;the-circle-function&quot;&gt;The circle() function &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#the-circle-function&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;figure&gt;
&lt;img alt=&quot;Illustration of the circle() shape value&quot; decoding=&quot;async&quot; height=&quot;220&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/jnKehwelADiEqVH9NMmX.png?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;The full notation for a circle shape value is &lt;code&gt;circle(r at cx cy)&lt;/code&gt; where &lt;code&gt;r&lt;/code&gt; is the radius of the circle, while &lt;code&gt;cx&lt;/code&gt; and &lt;code&gt;cy&lt;/code&gt; are coordinates of the circle center on the X-axis and Y-axis. The coordinates for the circle center are optional. If you omit them, the center of the element (the intersection of its diagonals) will be used as the default.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; left&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;In the example above, content will wrap around the outside of a circular path. The single argument &lt;code&gt;50%&lt;/code&gt; specifies the radius of the circle, which, in this specific case, amounts to half of the element&#39;s width or height. Changing the dimensions of the element will influence the radius of the circle shape. This is a basic example of how CSS Shapes can be responsive.&lt;/p&gt;
&lt;p&gt;Before going further, a quick aside: it is important to remember that CSS Shapes influence only the shape of the float area around an element. If the element has a background, that will not be clipped by the shape. To achieve that effect, you must use properties from &lt;a href=&quot;http://www.html5rocks.com/en/tutorials/masking/adobe/&quot; rel=&quot;noopener&quot;&gt;CSS Masking&lt;/a&gt; - either &lt;a href=&quot;http://docs.webplatform.org/wiki/css/properties/clip-path&quot; rel=&quot;noopener&quot;&gt;clip-path&lt;/a&gt; or &lt;a href=&quot;http://docs.webplatform.org/wiki/css/properties/mask-image&quot; rel=&quot;noopener&quot;&gt;mask-image&lt;/a&gt;. The &lt;code&gt;clip-path&lt;/code&gt; property comes in very handy because it follows the same notation as CSS Shapes, so you can reuse values.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt=&quot;Illustration of &amp;#x60;circle()&amp;#x60; shape + clip-path&quot; decoding=&quot;async&quot; height=&quot;290&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/zAHfcfEKxoEa9q8p6kE0.png?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;Illustrations throughout this document use clipping to highlight the shape and help you understand the effects.&lt;/p&gt;
&lt;p&gt;Back to the circle shape.&lt;/p&gt;
&lt;p&gt;When using percentages for the circle radius, the value is actually computed with a slightly more complex &lt;a href=&quot;http://www.w3.org/TR/css-shapes/#funcdef-circle&quot; rel=&quot;noopener&quot;&gt;formula&lt;/a&gt;: sqrt(width^2 + height^2) / sqrt(2). It&#39;s useful to understand this because it will help you imagine what the resulting circle shape will be if the element&#39;s dimensions are not equal.&lt;/p&gt;
&lt;p&gt;All CSS unit types can be used in shape function coordinates - px, em, rem, vw, vh, and so forth. You can pick the one which is flexible or rigid enough for your needs.&lt;/p&gt;
&lt;p&gt;You can adjust the circle&#39;s position by setting explicit values for the coordinates of its center.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50% at 0 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;This positions the circle center at the origin of the coordinate system. What is the coordinate system? This is where we introduce reference boxes.&lt;/p&gt;
&lt;h2 id=&quot;reference-boxes-for-css-shapes&quot;&gt;Reference boxes for CSS Shapes &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#reference-boxes-for-css-shapes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The reference box is a virtual box around the element, which establishes the coordinate system used to draw and position the shape. The origin of the coordinate system is at its upper-left corner with the X-axis pointing to the right and the Y-axis pointing down.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt=&quot;Coordinate system for CSS Shapes&quot; decoding=&quot;async&quot; height=&quot;310&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/UY8jOJVxbglzUnVTr5rH.png?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;Remember that &lt;code&gt;shape-outside&lt;/code&gt; alters the shape of the float area around which content will wrap. The float area extends to the outer edges of the box defined by the &lt;code&gt;margin&lt;/code&gt; property. This is called the &lt;code&gt;margin-box&lt;/code&gt; and it is the default reference box for a shape if none is explicitly mentioned.&lt;/p&gt;
&lt;p&gt;The following two CSS declarations have identical results:&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50% at 0 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;/* identical to: */&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50% at 0 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; margin-box&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;We have not yet set a margin on the element. At this point it is safe to assume that the origin of the coordinate system and the circle center are at the upper-left corner of the element&#39;s content area. This changes when you do set a margin:&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50% at 0 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; margin-box&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;The origin of the coordinate system now lies outside the element&#39;s content area (100px up and 100px left), as does the circle center. The computed value of the circle radius also grows to account for the increased surface of the coordinate system established by the &lt;code&gt;margin-box&lt;/code&gt; reference box.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt=&quot;Margin-box coordinate system with and without margin&quot; decoding=&quot;async&quot; height=&quot;500&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/90l2cTKm1tLgSajkStCu.png?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;figure&gt;
&lt;p&gt;There are a few reference box options to choose from: &lt;code&gt;margin-box&lt;/code&gt;, &lt;code&gt;border-box&lt;/code&gt;, &lt;code&gt;padding-box&lt;/code&gt; and &lt;code&gt;content-box&lt;/code&gt;. Their names imply their boundaries. We previously explained the &lt;code&gt;margin-box&lt;/code&gt;. The &lt;code&gt;border-box&lt;/code&gt; is constrained by the outer edges of the element&#39;s borders, the &lt;code&gt;padding-box&lt;/code&gt; is constrained by the element&#39;s padding, while the &lt;code&gt;content-box&lt;/code&gt; is identical to the actual surface area used by the content within an element.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt=&quot;Illustration of all reference boxes&quot; decoding=&quot;async&quot; height=&quot;350&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/NWIXGzzRmUcWtS863jCu.png?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;Only one reference box can be used at a given time with a &lt;code&gt;shape-outside&lt;/code&gt; declaration. Each reference box will influence the shape in a different and sometimes subtle way. There is another article which delves deeper and helps you &lt;a href=&quot;http://razvancaliman.com/writing/css-shapes-reference-boxes&quot; rel=&quot;noopener&quot;&gt;understand reference boxes for CSS Shapes&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;the-ellipse-function&quot;&gt;The ellipse() function &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#the-ellipse-function&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;figure&gt;
&lt;img alt=&quot;Illustration of ellipse() shape value&quot; decoding=&quot;async&quot; height=&quot;240&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/FarSgibjiuXojpuukfsX.png?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;Ellipses look like squished circles. They are defined as &lt;code&gt;ellipse(rx ry at cx cy)&lt;/code&gt;, where &lt;code&gt;rx&lt;/code&gt; and &lt;code&gt;ry&lt;/code&gt; are the radii for the ellipse on the X-axis and Y-axis, while &lt;code&gt;cx&lt;/code&gt; and &lt;code&gt;cy&lt;/code&gt; are the coordinates for the center of the ellipse.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;ellipse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;150px 300px at 50% 50%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 600px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;Percentage values will be computed from the dimensions of the coordinate system. No funny maths required here. You can omit the coordinates for the ellipse center and they will be inferred from the center of the coordinate system.&lt;/p&gt;
&lt;p&gt;Radii on the X and Y axes may also be defined with keywords: &lt;code&gt;farthest-side&lt;/code&gt; yields a radius equal to the distance between the ellipse center and the side of the reference box farthest away from it, while &lt;code&gt;closest-side&lt;/code&gt; means the exact opposite - use the shortest distance between the center and a side.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;ellipse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;closest-side farthest-side at 50% 50%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;/* identical to: */&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;ellipse&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;150px 300px at 50% 50%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 600px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;This may come in handy when the element&#39;s dimensions (or the reference box) may change in unpredictable ways, but you want the ellipse shape to adapt.&lt;/p&gt;
&lt;p&gt;The same &lt;code&gt;farthest-side&lt;/code&gt; and &lt;code&gt;closest-side&lt;/code&gt; keywords can also be used for the radius in the &lt;code&gt;circle()&lt;/code&gt; shape function.&lt;/p&gt;
&lt;h2 id=&quot;the-polygon-function&quot;&gt;The polygon() function &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#the-polygon-function&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;figure&gt;
&lt;img alt=&quot;Illustration of polygon() shape value&quot; decoding=&quot;async&quot; height=&quot;480&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/nXbsN26mVG6KDsuGEf5u.jpg?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;If circles and ellipses are too limiting, the polygon shape function opens up a world of options. The format is &lt;code&gt;polygon(x1 y1, x2 y2, ...)&lt;/code&gt; where you specify pairs of x y coordinates for each vertex (point) of a polygon. The minimum number of pairs to specify a polygon is three, a triangle.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;polygon&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0 300px&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 300px 600px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 300px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 600px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;Vertices are placed on the coordinate system. For responsive polygons you can use percentage values for some or all of the coordinates.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;/* polygon responsive to font-size*/&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;polygon&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0 100%&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 100% 100%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 20em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 40em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;There is an optional &lt;code&gt;fill-rule&lt;/code&gt; parameter, &lt;a href=&quot;http://www.w3.org/TR/SVG/painting.html#FillRuleProperty&quot; rel=&quot;noopener&quot;&gt;imported from SVG&lt;/a&gt;, which instructs the browser how to consider the “insideness” of a polygon in case of self-intersecting paths or enclosed shapes. Joni Trythall explains very well &lt;a href=&quot;http://www.sitepoint.com/understanding-svg-fill-rule-property/&quot; rel=&quot;noopener&quot;&gt;how the fill-rule property works&lt;/a&gt; in SVG. If not defined, the &lt;code&gt;fill-rule&lt;/code&gt; defaults to &lt;code&gt;nonzero&lt;/code&gt;.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;polygon&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0 100%&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 100% 100%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;/* identical to: */&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;polygon&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;nonzero&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0 100%&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 100% 100%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;h2 id=&quot;the-inset-function&quot;&gt;The inset() function &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#the-inset-function&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;inset()&lt;/code&gt; shape function allows you create rectangular shapes around which to wrap content. This might sound counter-intuitive considering the initial premise that CSS Shapes free web content from simple boxes. It may very well be. I have yet to find a use case for &lt;code&gt;inset()&lt;/code&gt; which isn&#39;t already achievable with floats and margins or with a &lt;code&gt;polygon()&lt;/code&gt;. Though &lt;code&gt;inset()&lt;/code&gt; does provide a more readable expression for rectangular shapes than &lt;code&gt;polygon()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The full notation for an inset shape function is &lt;code&gt;inset(top right bottom left border-radius)&lt;/code&gt;. The first four position arguments are offsets inwards from the element&#39;s edges. The last argument is the border radius for the rectangular shape. It is optional, so you can leave it out. It follows the &lt;code&gt;border-radius&lt;/code&gt; shorthand notation you already use in CSS.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;inset&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;100px 100px 100px 100px&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;/* yields a rectangular shape which is 100px inset on all sides */&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; left&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;h2 id=&quot;creating-shapes-from-reference-boxes&quot;&gt;Creating shapes from reference-boxes &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#creating-shapes-from-reference-boxes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you don&#39;t specify a shape function to the &lt;code&gt;shape-outside&lt;/code&gt; property, you can allow the browser to derive a shape from the element&#39;s reference box. The default reference box is &lt;code&gt;margin-box&lt;/code&gt;. Nothing exotic so far, that&#39;s how floats already work. But applying this technique, you can reuse the geometry of an element. Let&#39;s look at the &lt;code&gt;border-radius&lt;/code&gt; property.&lt;/p&gt;
&lt;p&gt;If you use it to round the corners of a floated element, you get the clipping effect, but the float area remains rectangular. Add &lt;code&gt;shape-outside: border-box&lt;/code&gt; to wrap around the contour created by the &lt;code&gt;border-radius&lt;/code&gt;.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt=&quot;Extracting a shape from an element&amp;#x27;s border-radius using the border-box reference box&quot; decoding=&quot;async&quot; height=&quot;390&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/YWeagoH1SuHlaw52AVjX.png?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; border-box&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; left&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;Of course, you can use all the reference boxes in this manner. Here&#39;s another use for derived shapes - offset pull-quotes.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt=&quot;Creating an offset pull-quote using the content-box reference box&quot; decoding=&quot;async&quot; height=&quot;380&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/24DvVC5KcEqNwhtstFS5.png?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;It is possible to achieve the offset pull-quote effect by using only float and margin properties. But that requires you to position the quote element in the HTML tree at the point you want it to render.&lt;/p&gt;
&lt;p&gt;Here&#39;s how to achieve the same offset pull-quote effect with added flexibility:&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.pull-quote&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; content-box&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;margin-top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 200px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; left&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;We explicitly set the &lt;code&gt;content-box&lt;/code&gt; reference box for the shape&#39;s coordinate system. In this case, the amount of content in the pull-quote defines the shape around which outside content will wrap. The &lt;code&gt;margin-top&lt;/code&gt; property is used here to position (offset) the pull-quote, regardless of its position in the HTML tree.&lt;/p&gt;
&lt;h2 id=&quot;shape-margin&quot;&gt;Shape margin &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#shape-margin&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You&#39;ll notice that wrapping content around a shape can make it rub too closely against the element. You can add spacing around the shape with the &lt;code&gt;shape-margin&lt;/code&gt; property.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;40%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; left&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;The effect is similar to what you&#39;re used to from using the regular &lt;code&gt;margin&lt;/code&gt; property, but the &lt;code&gt;shape-margin&lt;/code&gt; affects only the space around &lt;code&gt;shape-outside&lt;/code&gt; value. It will add spacing around the shape only if there is room for it in the coordinate system. That&#39;s why in the example above the circle radius is set to 40%, not 50%. If the radius was set to 50%, the circle would have taken up all the space in the coordinate system leaving no room for the effect of &lt;code&gt;shape-margin&lt;/code&gt;. Remember, the shape is ultimately constrained to the element’s &lt;code&gt;margin-box&lt;/code&gt; (the element plus its surrounding &lt;code&gt;margin&lt;/code&gt;). If the shape is larger and overflows, it will be clipped to the &lt;code&gt;margin-box&lt;/code&gt; and you will end up with a rectangular shape.&lt;/p&gt;
&lt;p&gt;It&#39;s important to understand that &lt;code&gt;shape-margin&lt;/code&gt; accepts only a single positive value. It does not have a long-hand notation. What is a shape-margin-top for a circle, anyway?&lt;/p&gt;
&lt;h2 id=&quot;animating-shapes&quot;&gt;Animating shapes &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#animating-shapes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can mix CSS shapes with many other CSS features, such as transitions and animations. Though, I must stress that users find it very annoying when text layout changes while they&#39;re reading. Pay close attention to the experience if you do decide in favor of animating shapes.&lt;/p&gt;
&lt;p&gt;You can animate the radii and centers for &lt;code&gt;circle()&lt;/code&gt; and &lt;code&gt;ellipse()&lt;/code&gt; shapes as long as they&#39;re defined in values that the browser can interpolate. Going from &lt;code&gt;circle(30%)&lt;/code&gt; to &lt;code&gt;circle(50%)&lt;/code&gt; is possible. However, animating between &lt;code&gt;circle(closest-side)&lt;/code&gt; to &lt;code&gt;circle(farthest-side)&lt;/code&gt; will choke the browser.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;30%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; shape-outside 1s&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; left&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;.element:hover&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;figure&gt;
&lt;img alt=&quot;GIF of animated circle&quot; decoding=&quot;async&quot; height=&quot;220&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/9u9cOCEXbNZxmi0lwnTg.gif?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;More interesting effects can be achieved when animating &lt;code&gt;polygon()&lt;/code&gt; shapes, with the important note that the polygon must have the same number of vertices between the two animation states. The browser can&#39;t interpolate if you add or remove vertices.&lt;/p&gt;
&lt;p&gt;One trick is to add the maximum amount of vertices you need and position them clustered together in the animation state where you want fewer perceived edges to the shape.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;/* four vertices (looks like rectangle) */&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;polygon&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 100% 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 100% 100%&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0 100%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;transition&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; shape-outside 1s&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;.element:hover&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;/* four vertices, but second and third overlap (looks like triangle) */&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;polygon&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 100% 50%&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 100% 50%&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0 100%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;figure&gt;
&lt;img alt=&quot;GIF of animated triangle&quot; decoding=&quot;async&quot; height=&quot;220&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/R7mVYgZXuzOpG6TqoJY5.gif?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;wrapping-content-inside-a-shape&quot;&gt;Wrapping content inside a shape &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#wrapping-content-inside-a-shape&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;figure&gt;
&lt;img alt=&quot;Screenshot of Alice in Wonderland demo using CSS Shapes to wrap content&quot; decoding=&quot;async&quot; height=&quot;447&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/QeB4NkU6zfkEM8MjdVkC.jpg?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;The initial draft of the CSS Shapes specification included a &lt;code&gt;shape-inside&lt;/code&gt; property which allowed you to wrap content inside of a shape. There were even implementations in Chrome and Webkit for a while. But wrapping arbitrarily-positioned content inside a custom path requires much more effort and research to cover all possible scenarios and avoid bugs. That&#39;s why the &lt;code&gt;shape-inside&lt;/code&gt; property has been deferred to &lt;a href=&quot;http://dev.w3.org/csswg/css-shapes-2/&quot; rel=&quot;noopener&quot;&gt;CSS Shapes Level 2&lt;/a&gt; and implementations for it have been withdrawn.&lt;/p&gt;
&lt;p&gt;However, with some effort and a bit of compromise, you can still achieve the effect of wrapping content inside a custom shape. The hack is to use two floated elements with &lt;code&gt;shape-outside&lt;/code&gt;, positioned at opposite sides of a container. The compromise is that you have to use one or two empty elements which have no semantic meaning, but serve as the struts to create the illusion of a shape inside.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&#39;&lt;/span&gt;left-shape&lt;span class=&quot;token punctuation&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&#39;&lt;/span&gt;right-shape&lt;span class=&quot;token punctuation&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  Lorem ipsum...&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;The position of the &lt;code&gt;.left-shape&lt;/code&gt; and &lt;code&gt;.right-shape&lt;/code&gt; strut elements at the top of the container is important because they will be floated to the left and to right in order to flank the content.&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.left-shape&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;polygon&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;0 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ...&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; left&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token selector&quot;&gt;.right-shape&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;polygon&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50% 0&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; ...&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; right&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 50%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token property&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 100%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;figure&gt;
&lt;img alt=&quot;Illustration of workaround for shape-inside for Alice demo&quot; decoding=&quot;async&quot; height=&quot;447&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 660px) 660px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/T4FyVKpzu4WKF1kBNvXepbi08t52/fvFledoh6z5Z4lGVmAKY.jpg?auto=format&amp;w=1320 1320w&quot; width=&quot;660&quot; /&gt;
&lt;/figure&gt;
&lt;p&gt;This styling makes the two floated struts take up all the space within the element, but the &lt;code&gt;shape-outside&lt;/code&gt; properties carve out space for the rest of the content.&lt;/p&gt;
&lt;p&gt;If CSS Shapes are not supported by the browser, this will yield ugly effects by pushing all of the content down. That&#39;s why it&#39;s important to use the feature in a progressively enhanced manner.&lt;/p&gt;
&lt;p&gt;In the earlier shape animation examples, you&#39;ll notice that text shifting around can be bothersome. Not all use cases warrant an animated shape. But you can animate other properties which interact with CSS Shapes to add effect where it makes sense.&lt;/p&gt;
&lt;p&gt;In the &lt;a href=&quot;http://adobe-webplatform.github.io/Demo-for-Alice-s-Adventures-in-Wonderland&quot; rel=&quot;noopener&quot;&gt;Alice in Wonderland&lt;/a&gt; demonstration of CSS Shapes, we used the scroll position to change the top margin of the content. The text is squeezed between two floated elements. As it moves down, it has to relayout according to the &lt;code&gt;shape-outside&lt;/code&gt; of the two floated elements. This gives the impression that the text is going down the rabbit hole and it adds to the storytelling experience. Borderline gratuitous? Maybe. But it does look cool.&lt;/p&gt;
&lt;p&gt;Because the text layout is done natively by the browser, the performance is better than using a JavaScript solution. But changing the margin-top on scroll does trigger lots of relayout and paint events, and that may noticeably reduce performance. Use with caution! However, using CSS Shapes without animating them does not come with a perceivable performance hit.&lt;/p&gt;
&lt;h2 id=&quot;progressive-enhancement&quot;&gt;Progressive enhancement &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#progressive-enhancement&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Start off by assuming that the browser does not have CSS Shapes support and build up on that when you do detect the feature. &lt;a href=&quot;http://modernizr.com/&quot; rel=&quot;noopener&quot;&gt;Modernizr&lt;/a&gt; is a good solution to do feature detection and there is a test for CSS Shapes in the &lt;a href=&quot;http://modernizr.com/download/#-css_shapes&quot; rel=&quot;noopener&quot;&gt;&#39;Non-core detects&#39;&lt;/a&gt; section.&lt;/p&gt;
&lt;p&gt;Some browsers provide feature detection in CSS via the &lt;code&gt;@supports&lt;/code&gt; rule without the need for external libraries. Google Chrome, which also supports CSS Shapes, understands the &lt;code&gt;@supports&lt;/code&gt; rule. This is how you use it to progressively enhance:&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;/* styles for all browsers */&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;token atrule&quot;&gt;&lt;span class=&quot;token rule&quot;&gt;@supports&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token comment&quot;&gt;/* styles only for browsers which support CSS Shapes */&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token selector&quot;&gt;.element&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;token property&quot;&gt;shape-outside&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;circle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;50%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;a href=&quot;https://twitter.com/leaverou&quot; rel=&quot;noopener&quot;&gt;Lea Verou&lt;/a&gt; has written more about &lt;a href=&quot;http://www.creativebloq.com/css3/how-use-supports-rule-your-css-11410545&quot; rel=&quot;noopener&quot;&gt;how to use the CSS @supports rule&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;disambiguation-from-css-exclusions&quot;&gt;Disambiguation from CSS Exclusions &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#disambiguation-from-css-exclusions&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;What we know today as CSS Shapes used to be called CSS Exclusions and Shapes in the early days of the spec. The switch in naming might seem as a nuance, but it is actually very important. &lt;a href=&quot;http://dev.w3.org/csswg/css-exclusions/&quot; rel=&quot;noopener&quot;&gt;CSS Exclusions&lt;/a&gt;, now a separate spec, enables wrapping content around elements positioned arbitrarily, without the need for a float property. Imagine wrapping content around an absolutely-positioned element; that&#39;s a use case for CSS Exclusions. CSS Shapes just define the path around which the content will wrap.&lt;/p&gt;
&lt;p&gt;So, shapes and exclusions are not the same thing, but they do complement each other. CSS Shapes are available in browsers today, while CSS Exclusions are not yet implemented with shapes interaction.&lt;/p&gt;
&lt;h2 id=&quot;tools-for-working-with-css-shapes&quot;&gt;Tools for working with CSS Shapes &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#tools-for-working-with-css-shapes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can create paths in classic image authoring tools, but none of them, at the time of this writing, exports the required syntax for CSS Shapes values. Even if they did, working like that wouldn&#39;t be too practical.&lt;/p&gt;
&lt;p&gt;CSS Shapes are meant to be used in the browser, where they react to other elements on the page. It&#39;s very useful to visualize the effects of editing the shape on the content which surrounds it. There are a few tools to help you with this workflow:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Brackets&lt;/strong&gt;: The &lt;a href=&quot;http://blog.brackets.io/2014/04/17/css-shapes-editor/&quot; rel=&quot;noopener&quot;&gt;CSS Shapes Editor extension for Brackets&lt;/a&gt; uses the code editor&#39;s live preview mode to overlay an interactive editor for editing shape values.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Google Chrome&lt;/strong&gt;: The &lt;a href=&quot;https://chrome.google.com/webstore/detail/css-shapes-editor/nenndldnbcncjmeacmnondmkkfedmgmp&quot; rel=&quot;noopener&quot;&gt;CSS Shapes Editor extension for Google Chrome&lt;/a&gt; extends the browser&#39;s Developer Tools with controls to create and edit shapes. It places an interactive editor on top of the selected element.&lt;/p&gt;
&lt;p&gt;The inspector in Google Chrome has built-in support for highlighting shapes. Hover over an element with a &lt;code&gt;shape-outside&lt;/code&gt; property and it will light up to illustrate the shape.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Shapes from images&lt;/strong&gt;: If you prefer to generate images and have the browser extract shapes from them, Rebecca Hauck has written a good &lt;a href=&quot;http://blogs.adobe.com/webplatform/2014/03/11/add-shape-and-depth-to-your-layout-with-photoshop-and-css-shapes/&quot; rel=&quot;noopener&quot;&gt;tutorial for Photoshop&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Polyfill&lt;/strong&gt;: Google Chrome is the first major browser to ship CSS Shapes. There is upcoming support for the feature on Apple&#39;s iOS 8 and Safari 8. Other browser vendors may consider it in the future. Until then, there is a &lt;a href=&quot;https://github.com/adobe-webplatform/css-shapes-polyfill&quot; rel=&quot;noopener&quot;&gt;CSS Shapes polyfill&lt;/a&gt; to provide basic support.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/shapes-getting-started/#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In a web where content is mostly trapped in simple boxes, CSS Shapes provide a way to create expressive layout, bridging the fidelity gap between web and print design. Of course, shapes can be abused and create distractions. But, when applied with taste and good judgement, shapes can enhance the content presentation and focus the user’s attention in a way which is unique to them.&lt;/p&gt;
&lt;p&gt;I leave you with a &lt;a href=&quot;https://www.behance.net/collection/25035325/Shapes&quot; rel=&quot;noopener&quot;&gt;collection of work&lt;/a&gt; by others, mostly from print, which demonstrates interesting uses for non-rectagular layout. I hope this inspires you to try CSS Shapes and experiment with new design ideas.&lt;/p&gt;
&lt;p&gt;Many thanks to Pearl Chen, Alan Stearns and Zoltan Horvath for reviewing this article and providing valuable insight.&lt;/p&gt;
&lt;/figure&gt;&lt;/figure&gt;</content>
    <author>
      <name>Razvan Caliman</name>
    </author>
  </entry>
</feed>
