CINXE.COM
CSS Shapes Module Level 1
<!doctype html><html lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"> <title>CSS Shapes Module Level 1</title> <meta content="CRD" name="w3c-status"> <meta content="Bikeshed version 82b9fec95, updated Fri Oct 14 15:43:55 2022 -0700" name="generator"> <link href="https://www.w3.org/TR/css-shapes/" rel="canonical"> <meta content="93f1062620cac97a4be85fffdd01c3734017280c" name="document-revision"> <script defer src="https://test.csswg.org/harness/annotate.js#!css-shapes-1_dev/css-shapes-1"></script> <style type="text/css"> .singleImgExample { display: block; margin: auto; } </style> <style>/* style-autolinks */ .css.css, .property.property, .descriptor.descriptor { color: var(--a-normal-text); font-size: inherit; font-family: inherit; } .css::before, .property::before, .descriptor::before { content: "‘"; } .css::after, .property::after, .descriptor::after { content: "’"; } .property, .descriptor { /* Don't wrap property and descriptor names */ white-space: nowrap; } .type { /* CSS value <type> */ font-style: italic; } pre .property::before, pre .property::after { content: ""; } [data-link-type="property"]::before, [data-link-type="propdesc"]::before, [data-link-type="descriptor"]::before, [data-link-type="value"]::before, [data-link-type="function"]::before, [data-link-type="at-rule"]::before, [data-link-type="selector"]::before, [data-link-type="maybe"]::before { content: "‘"; } [data-link-type="property"]::after, [data-link-type="propdesc"]::after, [data-link-type="descriptor"]::after, [data-link-type="value"]::after, [data-link-type="function"]::after, [data-link-type="at-rule"]::after, [data-link-type="selector"]::after, [data-link-type="maybe"]::after { content: "’"; } [data-link-type].production::before, [data-link-type].production::after, .prod [data-link-type]::before, .prod [data-link-type]::after { content: ""; } [data-link-type=element], [data-link-type=element-attr] { font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace; font-size: .9em; } [data-link-type=element]::before { content: "<" } [data-link-type=element]::after { content: ">" } [data-link-type=biblio] { white-space: pre; }</style> <style>/* style-counters */ body { counter-reset: example figure issue; } .issue { counter-increment: issue; } .issue:not(.no-marker)::before { content: "Issue " counter(issue); } .example { counter-increment: example; } .example:not(.no-marker)::before { content: "Example " counter(example); } .invalid.example:not(.no-marker)::before, .illegal.example:not(.no-marker)::before { content: "Invalid Example" counter(example); } figcaption { counter-increment: figure; } figcaption:not(.no-marker)::before { content: "Figure " counter(figure) " "; }</style> <style>/* style-dfn-panel */ :root { --dfnpanel-bg: #ddd; --dfnpanel-text: var(--text); } .dfn-panel { position: absolute; z-index: 35; height: auto; width: -webkit-fit-content; width: fit-content; max-width: 300px; max-height: 500px; overflow: auto; padding: 0.5em 0.75em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--dfnpanel-bg); color: var(--dfnpanel-text); border: outset 0.2em; } .dfn-panel:not(.on) { display: none; } .dfn-panel * { margin: 0; padding: 0; text-indent: 0; } .dfn-panel > b { display: block; } .dfn-panel a { color: var(--dfnpanel-text); } .dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; } .dfn-panel > b + b { margin-top: 0.25em; } .dfn-panel ul { padding: 0; } .dfn-panel li { list-style: inside; } .dfn-panel.activated { display: inline-block; position: fixed; left: .5em; bottom: 2em; margin: 0 auto; max-width: calc(100vw - 1.5em - .4em - .5em); max-height: 30vh; } .dfn-paneled { cursor: pointer; } </style> <style>/* style-issues */ a[href].issue-return { float: right; float: inline-end; color: var(--issueheading-text); font-weight: bold; text-decoration: none; } </style> <style>/* style-md-lists */ /* This is a weird hack for me not yet following the commonmark spec regarding paragraph and lists. */ [data-md] > :first-child { margin-top: 0; } [data-md] > :last-child { margin-bottom: 0; }</style> <style>/* style-selflinks */ :root { --selflink-text: white; --selflink-bg: gray; --selflink-hover-text: black; } .heading, .issue, .note, .example, li, dt { position: relative; } a.self-link { position: absolute; top: 0; left: calc(-1 * (3.5rem - 26px)); width: calc(3.5rem - 26px); height: 2em; text-align: center; border: none; transition: opacity .2s; opacity: .5; } a.self-link:hover { opacity: 1; } .heading > a.self-link { font-size: 83%; } li > a.self-link { left: calc(-1 * (3.5rem - 26px) - 2em); } dfn > a.self-link { top: auto; left: auto; opacity: 0; width: 1.5em; height: 1.5em; background: var(--selflink-bg); color: var(--selflink-text); font-style: normal; transition: opacity .2s, background-color .2s, color .2s; } dfn:hover > a.self-link { opacity: 1; } dfn > a.self-link:hover { color: var(--selflink-hover-text); } a.self-link::before { content: "¶"; } .heading > a.self-link::before { content: "§"; } dfn > a.self-link::before { content: "#"; } </style> <link href="https://www.w3.org/StyleSheets/TR/2021/W3C-CRD" rel="stylesheet"> <body class="h-entry"> <div class="head"> <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p> <h1 class="p-name no-ref" id="title">CSS Shapes Module Level 1</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types#CRD">W3C Candidate Recommendation Draft</a>, <time class="dt-updated" datetime="2022-11-15">15 November 2022</time></p> <details open> <summary>More details about this document</summary> <div data-fill-with="spec-metadata"> <dl> <dt>This version: <dd><a class="u-url" href="https://www.w3.org/TR/2022/CRD-css-shapes-1-20221115/">https://www.w3.org/TR/2022/CRD-css-shapes-1-20221115/</a> <dt>Latest published version: <dd><a href="https://www.w3.org/TR/css-shapes/">https://www.w3.org/TR/css-shapes/</a> <dt>Editor's Draft: <dd><a href="https://drafts.csswg.org/css-shapes/">https://drafts.csswg.org/css-shapes/</a> <dt>Previous Versions: <dd><a href="https://www.w3.org/TR/2014/CR-css-shapes-1-20140320/" rel="prev">https://www.w3.org/TR/2014/CR-css-shapes-1-20140320/</a> <dt>History: <dd><a class="u-url" href="https://www.w3.org/standards/history/css-shapes-1">https://www.w3.org/standards/history/css-shapes-1</a> <dt>Implementation Report: <dd><a href="https://wpt.fyi/results/css/css-shapes">https://wpt.fyi/results/css/css-shapes</a> <dt>Test Suite: <dd><a href="http://test.csswg.org/suites/css-shapes-1_dev/nightly-unstable/">http://test.csswg.org/suites/css-shapes-1_dev/nightly-unstable/</a> <dt>Feedback: <dd><a href="https://github.com/w3c/csswg-drafts/labels/css-shapes-1">CSSWG Issues Repository</a> <dt class="editor">Editors: <dd class="editor p-author h-card vcard" data-editor-id="49885"><a class="p-name fn u-email email" href="mailto:ratan@microsoft.com">Rossen Atanassov</a> (<span class="p-org org">Microsoft Corporation</span>) <dd class="editor p-author h-card vcard" data-editor-id="46659"><a class="p-name fn u-email email" href="mailto:stearns@adobe.com">Alan Stearns</a> (<span class="p-org org">Adobe</span>) <dt class="editor">Former Editor: <dd class="editor p-author h-card vcard"><span class="p-name fn">Vincent Hardy</span> <dt>Suggest an Edit for this Spec: <dd><a href="https://github.com/w3c/csswg-drafts/blob/main/css-shapes-1/Overview.bs">GitHub Editor</a> </dl> </div> </details> <div data-fill-with="warning"></div> <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2022 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="https://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document" rel="license">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <div class="p-summary" data-fill-with="abstract"> <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2> <p>CSS Shapes describe geometric shapes for use in CSS. For Level 1, CSS Shapes can be applied to floats. A circle shape on a float will cause inline content to <a data-link-type="dfn" href="#wrap" id="ref-for-wrap">wrap</a> around the circle shape instead of the float’s bounding box.</p> <a href="https://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc. </div> <h2 class="no-num no-toc no-ref heading settled" id="sotd"><span class="content">Status of this document</span></h2> <div data-fill-with="status"> <p><em>This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/">W3C technical reports index at https://www.w3.org/TR/.</a></em> </p> <p> This document was published by the <a href="https://www.w3.org/groups/wg/css">CSS Working Group</a> as a <strong>Candidate Recommendation Draft</strong> using the <a href="https://www.w3.org/2021/Process-20211102/#recs-and-notes">Recommendation track</a>. Publication as a Candidate Recommendation does not imply endorsement by <abbr title="World Wide Web Consortium">W3C</abbr> and its Members. A Candidate Recommendation Draft integrates changes from the previous Candidate Recommendation that the Working Group intends to include in a subsequent Candidate Recommendation Snapshot. </p> <p> This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. </p> <p>Please send feedback by <a href="https://github.com/w3c/csswg-drafts/issues">filing issues in GitHub</a> (preferred), including the spec code “css-shapes” in the title, like this: “[css-shapes] <i>…summary of comment…</i>”. All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>. Alternately, feedback can be sent to the (<a href="https://lists.w3.org/Archives/Public/www-style/">archived</a>) public mailing list <a href="mailto:www-style@w3.org?Subject=%5Bcss-shapes%5D%20PUT%20SUBJECT%20HERE">www-style@w3.org</a>. </p> <p>This document is governed by the <a href="https://www.w3.org/2021/Process-20211102/" id="w3c_process_revision">2 November 2021 W3C Process Document</a>. </p> <p>This document was produced by a group operating under the <a href="https://www.w3.org/Consortium/Patent-Policy-20200915/">W3C Patent Policy</a>. W3C maintains a <a href="https://www.w3.org/groups/wg/css/ipr" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy-20200915/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy-20200915/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p> <p></p> </div> <div data-fill-with="at-risk"></div> <nav data-fill-with="table-of-contents" id="toc"> <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2> <ol class="toc" role="directory"> <li> <a href="#intro"><span class="secno">1</span> <span class="content"> Introduction</span></a> <ol class="toc"> <li><a href="#module-interactions"><span class="secno">1.1</span> <span class="content"> Module Interactions</span></a> <li><a href="#values"><span class="secno">1.2</span> <span class="content">Values</span></a> <li><a href="#animations"><span class="secno">1.3</span> <span class="content">Animated Values</span></a> <li><a href="#terminology"><span class="secno">1.4</span> <span class="content"> Terminology</span></a> </ol> <li><a href="#relation-to-box-model-and-float-behavior"><span class="secno">2</span> <span class="content"> Relation to the box model and float behavior</span></a> <li> <a href="#basic-shape-functions"><span class="secno">3</span> <span class="content"> Basic Shapes</span></a> <ol class="toc"> <li><a href="#supported-basic-shapes"><span class="secno">3.1</span> <span class="content"> Supported Shapes</span></a> <li><a href="#basic-shape-computed-values"><span class="secno">3.2</span> <span class="content"> Computed Values of Basic Shapes</span></a> <li><a href="#basic-shape-serialization"><span class="secno">3.3</span> <span class="content"> Serialization of Basic Shapes</span></a> <li><a href="#basic-shape-interpolation"><span class="secno">3.4</span> <span class="content"> Interpolation of Basic Shapes</span></a> </ol> <li><a href="#shapes-from-image"><span class="secno">4</span> <span class="content"> Shapes from Image</span></a> <li><a href="#shapes-from-box-values"><span class="secno">5</span> <span class="content"> Shapes from Box Values</span></a> <li> <a href="#declaring-shapes"><span class="secno">6</span> <span class="content"> Declaring Shapes</span></a> <ol class="toc"> <li><a href="#shape-outside-property"><span class="secno">6.1</span> <span class="content"> Float Area Shape: the <span class="property">shape-outside</span> property</span></a> <li><a href="#shape-image-threshold-property"><span class="secno">6.2</span> <span class="content"> Choosing Image Pixels: the <span class="property">shape-image-threshold</span> property</span></a> <li><a href="#shape-margin-property"><span class="secno">6.3</span> <span class="content"> Expanding a Shape: the <span class="property">shape-margin</span> property</span></a> </ol> <li><a href="#privacy"><span class="secno">7</span> <span class="content">Privacy Considerations</span></a> <li><a href="#security"><span class="secno">8</span> <span class="content">Security Considerations</span></a> <li><a href="#acknowledgments"><span class="secno"></span> <span class="content"> Acknowledgments</span></a> <li> <a href="#change-log"><span class="secno"></span> <span class="content"> Change Log</span></a> <ol class="toc"> <li><a href="#20140320"><span class="secno"></span> <span class="content"> Since <span>March 20th 2014</span></span></a> <li><a href="#20140211"><span class="secno"></span> <span class="content"> Since <span>February 11th 2014</span></span></a> <li><a href="#20131203"><span class="secno"></span> <span class="content"> Since <span>December 3rd 2013</span></span></a> <li><a href="#20130620"><span class="secno"></span> <span class="content"> Since <span>June 20th 2013</span></span></a> <li><a href="#20120503"><span class="secno"></span> <span class="content"> Since <span>May 3rd 2012</span></span></a> <li><a href="#20111213"><span class="secno"></span> <span class="content"> Since <span>December 13th 2011</span></span></a> </ol> <li> <a href="#w3c-conformance"><span class="secno"></span> <span class="content"> Conformance</span></a> <ol class="toc"> <li><a href="#w3c-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a> <li><a href="#w3c-conformance-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a> <li> <a href="#w3c-partial"><span class="secno"></span> <span class="content"> Partial implementations</span></a> <ol class="toc"> <li><a href="#w3c-conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a> </ol> <li><a href="#w3c-testing"><span class="secno"></span> <span class="content"> Non-experimental implementations</span></a> <li><a href="#w3c-cr-exit-criteria"><span class="secno"></span> <span class="content"> CR exit criteria</span></a> </ol> <li> <a href="#index"><span class="secno"></span> <span class="content">Index</span></a> <ol class="toc"> <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a> <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a> </ol> <li> <a href="#references"><span class="secno"></span> <span class="content">References</span></a> <ol class="toc"> <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a> <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a> </ol> <li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a> </ol> </nav> <main> <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content"> Introduction</span><a class="self-link" href="#intro"></a></h2> <p><em>This section is not normative.</em></p> <p>Shapes define arbitrary geometries that can be used as CSS values. This specification defines properties to control the geometry of an element’s <a data-link-type="dfn" href="#float-area" id="ref-for-float-area">float area</a>. The <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside">shape-outside</a> property uses shape values to define the <span id="ref-for-float-area①">float area</span> for a float.</p> <p class="note" role="note"><span>Note:</span> Future levels of CSS Shapes will allow use of shapes on elements other than floats. Other CSS modules can make use of shapes as well, such as CSS Masking <a data-link-type="biblio" href="#biblio-css-masking">[CSS-MASKING]</a> and CSS Exclusions <a data-link-type="biblio" href="#biblio-css3-exclusions">[CSS3-EXCLUSIONS]</a>.</p> <p class="note" role="note"><span>Note:</span> If a user agent implements both CSS Shapes and CSS Exclusions, the <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside①">shape-outside</a> property defines the exclusion area for an exclusion.</p> <p class="note" role="note"><span>Note:</span> A future level of CSS Shapes will define a shape-inside property, which will define a shape to <a data-link-type="dfn" href="#wrap" id="ref-for-wrap①">wrap</a> content within the element.</p> <h3 class="heading settled" data-level="1.1" id="module-interactions"><span class="secno">1.1. </span><span class="content"> Module Interactions</span><a class="self-link" href="#module-interactions"></a></h3> <p>This module extends the float features defined in <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a> chapter 9.</p> <h3 class="heading settled" data-level="1.2" id="values"><span class="secno">1.2. </span><span class="content">Values</span><a class="self-link" href="#values"></a></h3> <p>This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a> using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from <a data-link-type="biblio" href="#biblio-css-values-3">[CSS-VALUES-3]</a>. Value types not defined in this specification are defined in CSS Values & Units <span>[CSS-VALUES-3]</span>. Combination with other CSS modules may expand the definitions of these value types.</p> <p>In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the <a data-link-type="dfn" href="https://www.w3.org/TR/css-values-4/#css-wide-keywords" id="ref-for-css-wide-keywords">CSS-wide keywords</a> as their property value. For readability they have not been repeated explicitly.</p> <h3 class="heading settled" data-level="1.3" id="animations"><span class="secno">1.3. </span><span class="content">Animated Values</span><a class="self-link" href="#animations"></a></h3> <p>It is expected that CSS will include ways to animate transitions between styles. In anticipation of that, this module includes a line "Animatable" for each property, which specifies whether and how values of the property can be animated.</p> <h3 class="heading settled" data-level="1.4" id="terminology"><span class="secno">1.4. </span><span class="content"> Terminology</span><a class="self-link" href="#terminology"></a></h3> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="wrap|wrapping" data-noexport id="wrap">Wrap</dfn></p> <p>This specification uses the term <a data-link-type="dfn" href="#wrap" id="ref-for-wrap②">wrap</a> to refer to flowing content around the sides of a <a data-link-type="dfn" href="#float-area" id="ref-for-float-area②">float area</a>, defined in <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a> chapter 9. Content <span id="ref-for-wrap③">wraps</span> around the right side of a left-floated box, and content <span id="ref-for-wrap④">wraps</span> around the left side of a right-floated box. One result of this <span id="ref-for-wrap⑤">wrapping</span> is that line boxes next to a float are shortened as necessary to avoid intersections with the <span id="ref-for-float-area③">float area</span>.</p> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="float-area">Float area</dfn></p> <p>The area used for <a data-link-type="dfn" href="#wrap" id="ref-for-wrap⑥">wrapping</a> content around a float element. The rules for float behavior use the sides of the <a data-link-type="dfn" href="#float-area" id="ref-for-float-area④">float area</a> to determine where content flows. By default, the <span id="ref-for-float-area⑤">float area</span> is the float element’s <a data-link-type="dfn" href="https://www.w3.org/TR/css-box-4/#margin-box" id="ref-for-margin-box">margin box</a> (note this can be different than the <span id="ref-for-float-area⑥">float area</span> produced by the <a class="css" data-link-type="maybe" href="#valdef-shape-box-margin-box" id="ref-for-valdef-shape-box-margin-box">margin-box</a> value, which includes border-radius curvature). This specification’s <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside②">shape-outside</a> property can be used to define an arbitrary, non-rectangular <span id="ref-for-float-area⑦">float area</span>.</p> <h2 class="heading settled" data-level="2" id="relation-to-box-model-and-float-behavior"><span class="secno">2. </span><span class="content"> Relation to the box model and float behavior</span><a class="self-link" href="#relation-to-box-model-and-float-behavior"></a></h2> <p>While the boundaries used for <a data-link-type="dfn" href="#wrap" id="ref-for-wrap⑦">wrapping</a> inline flow content outside a float can be defined using shapes, the actual box model does not change. If the element has specified margins, borders or padding they will be computed and rendered according to the <a data-link-type="biblio" href="#biblio-css3box">[CSS3BOX]</a> module. Also, float positioning and stacking are not affected by defining a <a data-link-type="dfn" href="#float-area" id="ref-for-float-area⑧">float area</a> with a shape.</p> <p>When a shape is used to define a <a data-link-type="dfn" href="#float-area" id="ref-for-float-area⑨">float area</a>, the shape is clipped to the float’s margin box. In other words, a shape can only ever reduce a <span id="ref-for-float-area①⓪">float area</span>, not increase it. A reduced <span id="ref-for-float-area①①">float area</span> may have no effect on some line boxes that would normally be affected by the float. If a shape does not enclose any area, the shape’s edges are still used to define the <span id="ref-for-float-area①②">float area</span>.</p> <p>A <a data-link-type="dfn" href="#float-area" id="ref-for-float-area①③">float area</a> defined by a shape may reduce the normal <span id="ref-for-float-area①④">float area</span> on all sides, but this does not allow content to <a data-link-type="dfn" href="#wrap" id="ref-for-wrap⑧">wrap</a> on both sides of a float. Left floats with a <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside③">shape-outside</a> still only allow content <span id="ref-for-wrap⑨">wrapping</span> on the right side, and right floats only allow <span id="ref-for-wrap①⓪">wrapping</span> on the left.</p> <div class="example" id="example-39c551b4"> <a class="self-link" href="#example-39c551b4"></a> <p>In the following example the left and right floating <code class="html">img</code> elements specify a triangular shape using the <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside④">shape-outside</a> property.</p> <pre><code><img class="left" src="hand.svg"/> <img class="right" src="hand.svg"/> <p> Sometimes a web page’s text content appears to be funneling your attention towards a spot on the page to drive you to follow a particular link. Sometimes you don’t notice. </p> <style type="text/css"> .left { shape-outside: polygon(0 0, 100% 100%, 0 100%); float: left; width: 40%; height: 12ex; transform: scaleX(-1); } .right { shape-outside: polygon(100% 0, 100% 100%, 0 100%); float: right; width: 40%; height: 12ex; } p { text-align: center; } </style> </code></pre> <p><img alt="Using the shape-outside property with floats" class="singleImgExample" height="130" src="images/hand-funnel.png" width="508"></p> </div> <div class="example" id="example-c9556a71"> <a class="self-link" href="#example-c9556a71"></a> <p>Since shapes are clipped to the float’s margin box, adding this shape to the left float above would result in the same rendering.</p> <pre><code>shape-outside: polygon(0 0, 500% 500%, 0 500%); </code></pre> </div> <div class="example" id="example-e8eedd7c"> <a class="self-link" href="#example-e8eedd7c"></a> <p>A shape that does not enclose any area still has edges that contribute to the <a data-link-type="dfn" href="#float-area" id="ref-for-float-area①⑤">float area</a>.</p> <p>This inset shape is a vertical line positioned at the midpoint of the reference box. This midpoint edge is used as the edge of the float area for wrapping content.</p> <pre><code>shape-outside: inset(0% 50% 0% 50%); </code></pre> <p>If inset values add up to more than the width, <a href="https://www.w3.org/TR/css-backgrounds-3/#corner-overlap"><cite>CSS Backgrounds 3</cite> § 4.5 Overlapping Curves</a> rules are used to determine the edges of the rectangle. This shape results in a vertical edge 25% from the left side of the reference box.</p> <pre><code>shape-outside: inset(0% 150% 50% 0%); </code></pre> <p>If the shape is only a horizontal line, then it is an empty float area and has no effect on wrapping. Note that in this example shape-margin must be 0px (otherwise the line would expand to enclose an area).</p> <pre><code>shape-outside: inset(50% 0% 0% 50%); shape-margin: 0px; </code></pre> </div> <div class="example" id="example-105c1362"> <a class="self-link" href="#example-105c1362"></a> <p>A <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside⑤">shape-outside</a> can create open areas on both the left and right of a <a data-link-type="dfn" href="#float-area" id="ref-for-float-area①⑥">float area</a>. Content still <a data-link-type="dfn" href="#wrap" id="ref-for-wrap①①">wraps</a> only on one side of a float in this case. In the picture, the shape is rendered in blue, and the content area outside the shape in mauve.</p> <pre><code>shape-outside: polygon(50px 0px, 100px 100px, 0px 100px); </code></pre> <p><img alt="wrapping around right side of a left-float float area" class="singleImgExample" height="113" src="images/float-side-example.png" width="263"></p> </div> <div class="example" id="example-8937ace2"> <a class="self-link" href="#example-8937ace2"></a> <p>The following styling creates a shape much smaller than the float’s content area, and adds a margin-top to the float. In the picture, the shape is rendered in blue, the content area outside the shape in mauve, and the margin area of the float box in yellow. The inline content only <a data-link-type="dfn" href="#wrap" id="ref-for-wrap①②">wraps</a> around the shape, and otherwise overlays the rest of the float margin box.</p> <pre><code>.float-left { shape-outside: polygon(0% 50%, 50% 100%, 0 100%); float: left; width: 100px; height: 100px; margin-top: 20px; } </code></pre> <p><img alt="Adding margin-top to a float with a small shape-outside" class="singleImgExample" height="133" src="images/float-margin-example.png" width="314"></p> <p>The next picture shows a possible result if two of these floats were stacked next to each other. Note that the floats are positioned using their margin boxes, not the <a data-link-type="dfn" href="#float-area" id="ref-for-float-area①⑦">float area</a>.</p> <p><img alt="Stacking two floats with a small shape-outside" class="singleImgExample" height="153" src="images/stacked-float-example.png" width="259"></p> </div> <h2 class="heading settled" data-level="3" id="basic-shape-functions"><span class="secno">3. </span><span class="content"> Basic Shapes</span><a class="self-link" href="#basic-shape-functions"></a></h2> <p>The <dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-basic-shape"><basic-shape></dfn> type can be specified using basic shape functions. When using this syntax to define shapes, the <dfn class="dfn-paneled" data-dfn-for="<basic-shape>" data-dfn-type="dfn" data-export id="basic-shape-reference-box">reference box</dfn> is defined by each property that uses <a class="production css" data-link-type="type" href="#typedef-basic-shape" id="ref-for-typedef-basic-shape" title="Expands to: circle() | ellipse() | inset() | path() | polygon() | rect() | reference box | xywh()"><basic-shape></a> values. The coordinate system for the shape has its origin on the top-left corner of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box">reference box</a> with the x-axis running to the right and the y-axis running downwards. All the lengths expressed in percentages are resolved from the used dimensions of the <span id="ref-for-basic-shape-reference-box①">reference box</span>.</p> <h3 class="heading settled" data-level="3.1" id="supported-basic-shapes"><span class="secno">3.1. </span><span class="content"> Supported Shapes</span><a class="self-link" href="#supported-basic-shapes"></a></h3> <p>The following shapes are supported. All <a class="production css" data-link-type="type" href="#typedef-basic-shape" id="ref-for-typedef-basic-shape①" title="Expands to: circle() | ellipse() | inset() | path() | polygon() | rect() | reference box | xywh()"><basic-shape></a> values use <a href="https://www.w3.org/TR/css3-values/#functional-notation">functional notation</a> and are defined here using the <a href="https://www.w3.org/TR/css3-values/#value-defs">Value Definition Syntax</a>.</p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="<basic-shape>" data-dfn-type="function" data-export id="funcdef-basic-shape-inset">inset()</dfn> = inset( <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage"><length-percentage></a>{1,4} [ round <a class="production css" data-link-type="property" href="https://www.w3.org/TR/css-backgrounds-3/#propdef-border-radius" id="ref-for-propdef-border-radius"><'border-radius'></a> ]? ) <dd> Defines an inset rectangle via insets from each edge of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box②">reference box</a>. <p>If less than four <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage①"><length-percentage></a> values are provided, the omitted values default in the same way as the <a class="property css" data-link-type="property" href="https://www.w3.org/TR/CSS2/box.html#propdef-margin" id="ref-for-propdef-margin">margin</a> shorthand: an omitted second or third value defaults to the first, and an omitted fourth value defaults to the second.</p> <p>The four <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage②"><length-percentage></a>s define the position of the top, right, bottom, and left edges of a rectangle, respectively, as insets from the corresponding edges of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box③">reference box</a>.</p> <p>A pair of insets in either dimension that add up to more than the used dimension (such as left and right insets of 75% apiece) use the <a href="https://www.w3.org/TR/css-backgrounds-3/#corner-overlap"><cite>CSS Backgrounds 3</cite> § 4.5 Overlapping Curves</a> rules to proportionally reduce the inset effect to 100%.</p> <div class="example" id="example-3c19dc9f"><a class="self-link" href="#example-3c19dc9f"></a> For example, specifying <span class="css">inset(75% 0 50% 0)</span> has the top+bottom edges summing to 125% of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box④">reference box’s</a> height. They’re proportionaly reduced to sum to 100%, identical to specifying <span class="css">inset(60% 0 40% 0)</span>. </div> <p>The optional <a class="production css" data-link-type="property" href="https://www.w3.org/TR/css-backgrounds-3/#propdef-border-radius" id="ref-for-propdef-border-radius①"><'border-radius'></a> argument(s) define rounded corners for the rectangle using the <span class="property" id="ref-for-propdef-border-radius②">border-radius</span> shorthand syntax.</p> <dt><dfn class="dfn-paneled css" data-dfn-for="<basic-shape>" data-dfn-type="function" data-export id="funcdef-basic-shape-xywh">xywh()</dfn> = xywh( <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage③"><length-percentage></a>{2} <span class="production" id="ref-for-typedef-length-percentage④"><length-percentage [0,∞]></span>{2} [ round <a class="production css" data-link-type="property" href="https://www.w3.org/TR/css-backgrounds-3/#propdef-border-radius" id="ref-for-propdef-border-radius③"><'border-radius'></a> ]? ) <dd> Defines a rectangle via offsets from the top and left edge of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box⑤">reference box</a>, and a specified width and height. <p>The four <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage⑤"><length-percentage></a>s define, respectively, the inset from the left edge of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box⑥">reference box</a>, the inset from the top edge of the <span id="ref-for-basic-shape-reference-box⑦">reference box</span>, the width of the rectangle, and the height of the rectangle.</p> <p class="note" role="note"><span>Note:</span> This syntax is inspired by the <code><a data-link-type="element-sub" href="https://www.w3.org/TR/SVG2/coords.html#TermViewBox" id="ref-for-TermViewBox">viewBox</a></code> attribute from SVG.</p> <p>The optional <a class="production css" data-link-type="property" href="https://www.w3.org/TR/css-backgrounds-3/#propdef-border-radius" id="ref-for-propdef-border-radius④"><'border-radius'></a> argument(s) define rounded corners for the inset rectangle using the <span class="property" id="ref-for-propdef-border-radius⑤">border-radius</span> shorthand syntax.</p> <dt><dfn class="dfn-paneled css" data-dfn-for="<basic-shape>" data-dfn-type="function" data-export id="funcdef-basic-shape-rect">rect()</dfn> = rect( [ <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage⑥"><length-percentage></a> | auto ]{4} [ round <a class="production css" data-link-type="property" href="https://www.w3.org/TR/css-backgrounds-3/#propdef-border-radius" id="ref-for-propdef-border-radius⑥"><'border-radius'></a> ]? ) <dd> Defines a rectangle via insets from the top and left edges of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box⑧">reference box</a>. <p>The four <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage⑦"><length-percentage></a>s define the position of the top, right, bottom, and left edges of a rectangle, respectively, as insets from the top edge of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box⑨">reference box</a> (for the first and third values) or the left edge of the <span id="ref-for-basic-shape-reference-box①⓪">reference box</span> (for the second and fourth values).</p> <p>An <span class="css">auto</span> value makes the edge of the box coincide with the corresponding edge of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box①①">reference box</a>: it’s equivalent to <span class="css">0%</span> as the first (top) or fourth (left) value, and equivalent to <span class="css">100%</span> as the second (right) or third (bottom) value.</p> <p>The second (right) and third (bottom) values are floored by the fourth (left) and second (top) values, respectively.</p> <div class="example" id="example-203cf4f2"><a class="self-link" href="#example-203cf4f2"></a> For example, specifying <span class="css">rect(10px 0 0 20px)</span> would place the bottom edge higher than the top edge, and the right edge further left than the left edge, so both are corrected to not cross over the other edge, identical to specifying <span class="css">rect(10px 20px 10px 20px)</span>. </div> <p class="note" role="note"><span>Note:</span> This syntax is similar, but not quite identical, to the legacy <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-rect" id="ref-for-funcdef-basic-shape-rect">rect()</a> function used solely by the <a class="property css" data-link-type="property" href="https://www.w3.org/TR/css-masking-1/#propdef-clip" id="ref-for-propdef-clip">clip</a> property.</p> <p>The optional <a class="production css" data-link-type="property" href="https://www.w3.org/TR/css-backgrounds-3/#propdef-border-radius" id="ref-for-propdef-border-radius⑦"><'border-radius'></a> argument(s) define rounded corners for the rectangle using the <span class="property" id="ref-for-propdef-border-radius⑧">border-radius</span> shorthand syntax.)</p> <dt><dfn class="dfn-paneled css" data-dfn-for="<basic-shape>" data-dfn-type="function" data-export id="funcdef-basic-shape-circle">circle()</dfn> = circle( <a class="production css" data-link-type="type" href="#typedef-shape-radius" id="ref-for-typedef-shape-radius"><shape-radius></a>? [ at <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-position" id="ref-for-typedef-position"><position></a> ]? ) <dd> <ul> <li> The shape-radius argument represents <strong>r</strong>, the radius of the circle. Negative values are invalid. A percentage value here is resolved from the used width and height of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box①②">reference box</a> as <br> <code>sqrt(<em>width</em><sup>2</sup>+<em>height</em><sup>2</sup>)/sqrt(2)</code>. <li> The position argument defines the center of the circle. This defaults to center if omitted. </ul> <dt><dfn class="dfn-paneled css" data-dfn-for="<basic-shape>" data-dfn-type="function" data-export id="funcdef-basic-shape-ellipse">ellipse()</dfn> = ellipse( [ <a class="production css" data-link-type="type" href="#typedef-shape-radius" id="ref-for-typedef-shape-radius①"><shape-radius></a>{2} ]? [ at <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-position" id="ref-for-typedef-position①"><position></a> ]? ) <dd> <ul> <li> The shape-radius arguments represent <strong>rx</strong> and <strong>ry</strong>, the x-axis and y-axis radii of the ellipse, in that order. Negative values for either radius are invalid. Percentage values here are resolved against the used width (for the rx value) and the used height (for the ry value) of the reference box. <li> The position argument defines the center of the ellipse. This defaults to center if omitted. </ul> <dt><dfn class="dfn-paneled css" data-dfn-for="<basic-shape>" data-dfn-type="function" data-export id="funcdef-basic-shape-polygon">polygon()</dfn> = polygon( <a class="production css" data-link-type="property" href="https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty" id="ref-for-FillRuleProperty"><'fill-rule'></a>? , [<a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage⑧"><length-percentage></a> <span class="production" id="ref-for-typedef-length-percentage⑨"><length-percentage></span>]# ) <dd> <ul> <li> <a class="production css" data-link-type="property" href="https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty" id="ref-for-FillRuleProperty①"><'fill-rule'></a> - The filling rule used to determine the interior of the polygon. See <a href="https://www.w3.org/TR/SVG/painting.html#FillRuleProperty">fill-rule</a> property in SVG for details. Possible values are <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-masking-1/#valdef-clip-rule-nonzero" id="ref-for-valdef-clip-rule-nonzero">nonzero</a> or <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-masking-1/#valdef-clip-rule-evenodd" id="ref-for-valdef-clip-rule-evenodd">evenodd</a>. Default value when omitted is <span class="css" id="ref-for-valdef-clip-rule-nonzero①">nonzero</span>. <li> Each pair argument in the list represents <strong>x<sub>i</sub></strong> and <strong>y<sub>i</sub></strong> - the <strong>x</strong> and <strong>y</strong> axis coordinates of the i-th vertex of the polygon. </ul> <p>The UA must close a polygon by connecting the last vertex with the first vertex of the list.</p> <dt><dfn class="dfn-paneled css" data-dfn-for="<basic-shape>" data-dfn-type="function" data-export id="funcdef-basic-shape-path">path()</dfn> = path( [<a class="production css" data-link-type="property" href="https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty" id="ref-for-FillRuleProperty②"><'fill-rule'></a>,]? <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#string-value" id="ref-for-string-value"><string></a> ) <dd> <ul> <li> <a class="production css" data-link-type="property" href="https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty" id="ref-for-FillRuleProperty③"><'fill-rule'></a> - The filling rule used to determine the interior of the path. See <a href="https://www.w3.org/TR/SVG/painting.html#FillRuleProperty">fill-rule</a> property in SVG for details. Possible values are <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-masking-1/#valdef-clip-rule-nonzero" id="ref-for-valdef-clip-rule-nonzero②">nonzero</a> or <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-masking-1/#valdef-clip-rule-evenodd" id="ref-for-valdef-clip-rule-evenodd①">evenodd</a>. Default value when omitted is <span class="css" id="ref-for-valdef-clip-rule-nonzero③">nonzero</span>. <li> The <dfn class="css" data-dfn-for="path()" data-dfn-type="value" data-export id="valdef-path-string"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#string-value" id="ref-for-string-value①"><string></a><a class="self-link" href="#valdef-path-string"></a></dfn> represents an <a href="https://www.w3.org/TR/SVG11/paths.html#PathData">SVG Path data string</a>. A path data string that does not conform to the to the grammar and parsing rules of SVG 1.1, or that does conform but defines an empty path, is <a data-link-type="dfn" href="https://www.w3.org/TR/css-syntax-3/#css-invalid" id="ref-for-css-invalid">invalid</a> and causes the entire <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-path" id="ref-for-funcdef-basic-shape-path">path()</a> to be <span id="ref-for-css-invalid①">invalid</span>. The initial position is defined by the first “move to” argument in the path string. For the initial direction follow SVG 1.1. </ul> <p>The UA must close a path with an implicit closepath command ("z" or "Z") if it is not present in the string for properties that require a closed loop (such as <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside⑥">shape-outside</a> and <a class="property css" data-link-type="property" href="https://www.w3.org/TR/css-masking-1/#propdef-clip-path" id="ref-for-propdef-clip-path">clip-path</a>).</p> </dl> <p>The arguments not defined above are defined as follows:</p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-type="type" data-export id="typedef-shape-radius"><a class="production css" data-link-type="type" href="#typedef-shape-radius" id="ref-for-typedef-shape-radius②"><shape-radius></a></dfn> = <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage①⓪"><length-percentage [0,∞]></a> | closest-side | farthest-side <dd> Defines a radius for a circle or ellipse. If omitted it defaults to closest-side. <ul> <li> <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="closest-side">closest-side</dfn> uses the length from the center of the shape to the closest side of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box①③">reference box</a>. For circles, this is the closest side in any dimension. For ellipses, this is the closest side in the radius dimension. <li> <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="farthest-side">farthest-side</dfn> uses the length from the center of the shape to the farthest side of the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box①④">reference box</a>. For circles, this is the farthest side in any dimension. For ellipses, this is the farthest side in the radius dimension. </ul> </dl> <p>Additionally, the three rectangular shape functions are grouped into a production for convenience:</p> <pre class="prod"><dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-basic-shape-rect"><basic-shape-rect></dfn> = <a class="production" data-link-type="function" href="#funcdef-basic-shape-inset" id="ref-for-funcdef-basic-shape-inset"><inset()></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one">|</a> <a class="production" data-link-type="function" href="#funcdef-basic-shape-rect" id="ref-for-funcdef-basic-shape-rect①"><rect()></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①">|</a> <a class="production" data-link-type="function" href="#funcdef-basic-shape-xywh" id="ref-for-funcdef-basic-shape-xywh"><xywh()></a> </pre> <h3 class="heading settled" data-level="3.2" id="basic-shape-computed-values"><span class="secno">3.2. </span><span class="content"> Computed Values of Basic Shapes</span><a class="self-link" href="#basic-shape-computed-values"></a></h3> <p>The values in a <a class="production css" data-link-type="type" href="#typedef-basic-shape" id="ref-for-typedef-basic-shape②" title="Expands to: circle() | ellipse() | inset() | path() | polygon() | rect() | reference box | xywh()"><basic-shape></a> function are computed as specified, with these exceptions:</p> <ul> <li> Omitted values are included and compute to their defaults. <li> A <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-position" id="ref-for-typedef-position②"><position></a> value in <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-circle" id="ref-for-funcdef-basic-shape-circle">circle()</a> or <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-ellipse" id="ref-for-funcdef-basic-shape-ellipse">ellipse()</a> is computed as a pair of offsets (horizontal then vertical) from the top left origin, each given as a <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage①①"><length-percentage></a>. <li> A <a class="production css" data-link-type="property" href="https://www.w3.org/TR/css-backgrounds-3/#propdef-border-radius" id="ref-for-propdef-border-radius⑨"><'border-radius'></a> value in a <a class="production css" data-link-type="type" href="#typedef-basic-shape-rect" id="ref-for-typedef-basic-shape-rect"><basic-shape-rect></a> function is computed as an expanded list of all eight <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage①②"><length-percentage></a> values. <li> All <a class="production css" data-link-type="type" href="#typedef-basic-shape-rect" id="ref-for-typedef-basic-shape-rect①"><basic-shape-rect></a> functions compute to the equivalent <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-inset" id="ref-for-funcdef-basic-shape-inset①">inset()</a> function. <p class="note" role="note"><span>Note:</span> Given <span class="css">rect(t r b l)</span>, the equivalent function is <span class="css">inset(t calc(100% - r) calc(100% - b) l)</span>. Given <span class="css">xywh(x y w h)</span>, the equivalent function is <span class="css">inset(y calc(x + w) calc(y + h) x)</span>.</p> </ul> <h3 class="heading settled" data-level="3.3" id="basic-shape-serialization"><span class="secno">3.3. </span><span class="content"> Serialization of Basic Shapes</span><a class="self-link" href="#basic-shape-serialization"></a></h3> <p>To serialize the <a class="production css" data-link-type="type" href="#typedef-basic-shape" id="ref-for-typedef-basic-shape③" title="Expands to: circle() | ellipse() | inset() | path() | polygon() | rect() | reference box | xywh()"><basic-shape></a> functions, serialize as per their individual grammars, in the order the grammars are written in, avoiding calc() expressions where possible, avoiding calc() transformations, omitting components when possible without changing the meaning, joining space-separated tokens with a single space, and following each serialized comma with a single space.</p> <div class="example" id="example-6083e402"> <a class="self-link" href="#example-6083e402"></a> <p>Since <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-position" id="ref-for-typedef-position③"><position></a> keywords stand in for percentages, keywords without an offset turn into percentages.</p> <pre><code>circle(at left bottom) serializes as "circle(at 0% 100%)" </code></pre> <p>Omitting components means that some default values do not show up in the serialization. But since <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-position" id="ref-for-typedef-position④"><position></a> always uses the 2- or 4-value form, a default <span class="production" id="ref-for-typedef-position⑤"><position></span> is not omitted.</p> <pre><code>circle(closest-side at center) serializes as "circle(at 50% 50%)" </code></pre> <p>Using grammar order means that <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-position" id="ref-for-typedef-position⑥"><position></a> values always give horizontal components first, then vertical.</p> <pre><code>circle(at bottom left) serializes as "circle(at 0% 100%)" </code></pre> <p>Avoiding calc() expressions means that some <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-position" id="ref-for-typedef-position⑦"><position></a> values that could be simplified to the 2-value form must be serialized in 4-value form instead.</p> <pre><code>circle(at right 5px bottom 10px) serializes as "circle(at right 5px bottom 10px)" not as "circle(at calc(100% - 5px) calc(100% - 10px))" </code></pre> <p>Avoiding calc() transformations means that if a specified (or computed) calc() must stay in calc() form, it will be used as-is, not reformulated with a different origin or reduced.</p> <pre><code>bottom calc(10% + 5px) serializes as "bottom calc(10% + 5px)" not as "top calc(90% - 5px)" or "calc(90% - 5px)" </code></pre> <p>Preferring 0% over a zero length comes up when you must supply an omitted offset.</p> <pre><code>circle(at right 5px top) serializes as "circle(at right 5px top 0%)" </code></pre> <p>Preferring left and top origins means that some percentage offsets will normalize to those origins (when calc can be avoided).</p> <pre><code>circle(at right 5% top 0px) serializes as "circle(at 95% 0%)" </code></pre> </div> <h3 class="heading settled" data-level="3.4" id="basic-shape-interpolation"><span class="secno">3.4. </span><span class="content"> Interpolation of Basic Shapes</span><a class="self-link" href="#basic-shape-interpolation"></a></h3> <p>For interpolating between one basic shape and a second, the rules below are applied. The values in the shape functions interpolate <a href="https://www.w3.org/TR/web-animations-1/#by-computed-value">by computed value</a>. The list values interpolate as length, percentage, or calc where possible. If list values are not one of those types but are identical (such as finding <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-masking-1/#valdef-clip-rule-nonzero" id="ref-for-valdef-clip-rule-nonzero④">nonzero</a> in the same list position in both lists) those values do interpolate.</p> <ul> <li> Both shapes must use the same <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box①⑤">reference box</a>. <li> If both shapes are the same type, that type is <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-ellipse" id="ref-for-funcdef-basic-shape-ellipse①">ellipse()</a> or <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-circle" id="ref-for-funcdef-basic-shape-circle①">circle()</a>, and none of the radii use the <a href="#closest-side" id="ref-for-closest-side"><span class="css">closest-side</span></a> or <a href="#farthest-side" id="ref-for-farthest-side"><span class="css">farthest-side</span></a> keywords, interpolate between each value in the shape functions. <li> If both shapes are of type <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-inset" id="ref-for-funcdef-basic-shape-inset②">inset()</a>, interpolate between each value in the shape functions. <li> If both shapes are of type <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-polygon" id="ref-for-funcdef-basic-shape-polygon">polygon()</a>, both polygons have the same number of vertices, and use the same <a class="production css" data-link-type="property" href="https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty" id="ref-for-FillRuleProperty④"><'fill-rule'></a>, interpolate between each value in the shape functions. <li> In all other cases no interpolation is specified. </ul> <h2 class="heading settled" data-level="4" id="shapes-from-image"><span class="secno">4. </span><span class="content"> Shapes from Image</span><a class="self-link" href="#shapes-from-image"></a></h2> <p>Another way of defining shapes is by specifying a source <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-images-3/#typedef-image" id="ref-for-typedef-image"><image></a> whose alpha channel is used to compute the shape. The shape is computed to be the path or paths that enclose the area(s) where the opacity of the specified image is greater than the <a class="property css" data-link-type="property" href="#propdef-shape-image-threshold" id="ref-for-propdef-shape-image-threshold">shape-image-threshold</a> value. The absence of any pixels with an alpha value greater than the specified threshold results in an empty float area that will not affect wrapping. If the <span class="property" id="ref-for-propdef-shape-image-threshold①">shape-image-threshold</span> is not specified, the initial value to be considered is 0.0.</p> <p>The image is sized and positioned as if it were a replaced element whose specified width and height are the same as the element’s used content box size.</p> <p>For animated raster image formats (such as <a href="https://www.w3.org/Graphics/GIF/spec-gif89a.txt">GIF</a>), the first frame of the animation sequence is used.</p> <div class="example" id="example-12b6dfcf"> <a class="self-link" href="#example-12b6dfcf"></a> <p>An image is floating to the left of a paragraph. The image shows the 3D version of the CSS logo over a transparent background. The logo has a shadow using an alpha-channel.</p> <p>The image defines its <a data-link-type="dfn" href="#float-area" id="ref-for-float-area①⑧">float area</a> through the <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside⑦">shape-outside</a> property.</p> <pre><code> <p> <img id="CSSlogo" src="CSS-logo1s.png"/> blah blah blah blah... </p> <style> #CSSlogo { float: left; shape-outside: attr(src url); shape-image-threshold: 0.1; } </style> </code></pre> <p>The <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside⑧">shape-outside</a> property re-uses the url from the src attribute of the img element.</p> <p>It is perfectly possible to display an image and use a different image for its <a data-link-type="dfn" href="#float-area" id="ref-for-float-area①⑨">float area</a>.</p> <p>In the figure below, the alpha-channel threshold is represented by the dotted line around the CSS logo.</p> <p>It’s then possible to affect where the lines of the paragraph start in three ways:</p> <ol> <li>Modifying the alpha channel in the image <li>Changing the value of the <a class="property css" data-link-type="property" href="#propdef-shape-image-threshold" id="ref-for-propdef-shape-image-threshold②">shape-image-threshold</a> property <li>Changing the value of the <a class="property css" data-link-type="property" href="#propdef-shape-margin" id="ref-for-propdef-shape-margin">shape-margin</a> property (see example 8) </ol> <figure> <img alt="A float shape around an image using its alpha-channel" height="251" src="images/shape-outside-image.png" style="width:70%" width="582"> <figcaption> A float shape around an image using its alpha-channel. </figcaption> </figure> </div> <h2 class="heading settled" data-level="5" id="shapes-from-box-values"><span class="secno">5. </span><span class="content"> Shapes from Box Values</span><a class="self-link" href="#shapes-from-box-values"></a></h2> <p>Shapes can be defined by reference to edges in the <a href="https://www.w3.org/TR/css-box-3/#box-model">CSS Box Model</a>. These edges include <a href="https://www.w3.org/TR/css3-background/#corner-shaping">border-radius curvature</a> <a data-link-type="biblio" href="#biblio-css3bg">[CSS3BG]</a> from the used border-radius values. The <a class="production css" data-link-type="type" href="#typedef-shape-box" id="ref-for-typedef-shape-box" title="Expands to: border-box | content-box | fill-box | margin-box | padding-box | stroke-box | svg viewport origin box | view-box"><shape-box></a> value extends the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-backgrounds-3/#typedef-box" id="ref-for-typedef-box" title="Expands to: border-box | content-box | fill-box | margin-box | padding-box | stroke-box | svg viewport origin box | view-box"><box></a> value to include <a class="css" data-link-type="maybe" href="#valdef-shape-box-margin-box" id="ref-for-valdef-shape-box-margin-box①">margin-box</a>. Its syntax is:</p> <pre class="prod"><dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-shape-box"><a class="production" data-link-type="type" href="#typedef-shape-box" id="ref-for-typedef-shape-box①" title="Expands to: border-box | content-box | fill-box | margin-box | padding-box | stroke-box | svg viewport origin box | view-box"><shape-box></a></dfn> = <a class="production" data-link-type="type" href="https://www.w3.org/TR/css-backgrounds-3/#typedef-box" id="ref-for-typedef-box①" title="Expands to: border-box | content-box | fill-box | margin-box | padding-box | stroke-box | svg viewport origin box | view-box"><box></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②">|</a> <a class="css" data-link-type="maybe" href="#valdef-shape-box-margin-box" id="ref-for-valdef-shape-box-margin-box②">margin-box</a> </pre> <p>The definitions of the values are:</p> <p>The <dfn class="dfn-paneled css" data-dfn-for="<shape-box>, shape-outside" data-dfn-type="value" data-export id="valdef-shape-box-margin-box">margin-box</dfn> value defines the shape enclosed by the outside margin edge. The corner radii of this shape are determined by the corresponding border-radius and margin values. If the ratio of <code>border-radius/margin</code> is 1 or more, or margin is negative or zero, then the margin box corner radius is <code>max(border-radius + margin, 0)</code>. If the ratio of <code>border-radius/margin</code> is less than 1, and margin is positive, then the margin box corner radius is <code>border-radius + margin * (1 + (ratio-1)^3)</code>.</p> <p>The <dfn class="dfn-paneled css" data-dfn-for="<shape-box>, shape-outside" data-dfn-type="value" data-export id="valdef-shape-box-border-box">border-box</dfn> value defines the shape enclosed by the outside border edge. This shape follows all of the normal border radius shaping rules for the outside of the border.</p> <p>The <dfn class="dfn-paneled css" data-dfn-for="<shape-box>, shape-outside" data-dfn-type="value" data-export id="valdef-shape-box-padding-box">padding-box</dfn> value defines the shape enclosed by the outside padding edge. This shape follows all of the normal border radius shaping rules for the inside of the border.</p> <p>The <dfn class="dfn-paneled css" data-dfn-for="<shape-box>, shape-outside" data-dfn-type="value" data-export id="valdef-shape-box-content-box">content-box</dfn> value defines the shape enclosed by the outside content edge. Each corner radius of this box is the larger of 0 or <code>border-radius - border-width - padding</code>.</p> <div class="example" id="example-3c169cbd"> <a class="self-link" href="#example-3c169cbd"></a> <p>Given the 100px square below with 10px padding, border and margins, the box values define these shapes:</p> <ul> <li><a class="css" data-link-type="maybe" href="#valdef-shape-box-margin-box" id="ref-for-valdef-shape-box-margin-box③">margin-box</a>: the shape containing all of the yellow pixels <li><a class="css" data-link-type="maybe" href="#valdef-shape-box-border-box" id="ref-for-valdef-shape-box-border-box">border-box</a>: the shape containing all of the black pixels <li><a class="css" data-link-type="maybe" href="#valdef-shape-box-padding-box" id="ref-for-valdef-shape-box-padding-box">padding-box</a>: the shape containing all of the mauve pixels <li><a class="css" data-link-type="maybe" href="#valdef-shape-box-content-box" id="ref-for-valdef-shape-box-content-box">content-box</a>: the shape containing all of the blue pixels </ul> <figure> <img alt="Colored boxes representing simple box edges" height="177" src="images/box-edges-simple.png" width="178"> <figcaption> Simple CSS Box Model Edges </figcaption> </figure> <p>And the same definitions apply to a more complex example with the same 100px square, but with these border, padding and margin properties:</p> <pre><code> border-radius: 20px 20px 20px 40px; border-width: 30px 10px 20px 10px; padding: 10px 20px 10px 10px; margin: 20px 10px 10px 10px; </code></pre> <figure> <img alt="Colored boxes representing complex box edges" height="217" src="images/box-edges-complex.png" width="189"> <figcaption> Complex CSS Box Model Edges </figcaption> </figure> </div> <div class="example" id="example-ae456cb1"> <a class="self-link" href="#example-ae456cb1"></a> <p>The difference between normal float wrapping and wrapping around the shape defined by the margin-box value is that the margin-box shape includes corner shaping. Take the 100px square with 10px padding, border and margins, but with a border-radius of 60px. If you make a left float out of it, content normally wraps in this manner:</p> <figure> <img alt="Text wrapping around float with no shape" height="172" src="images/normal-wrap.png" width="311"> <figcaption> Normal float wrapping </figcaption> </figure> <p>If you add a margin-box shape to the float, then content wraps around the rounded margin-box corners.</p> <pre><code> shape-outside: margin-box; </code></pre> <figure> <img alt="Text wrapping around float with margin-box shape" height="173" src="images/margin-box-wrap.png" width="303"> <figcaption> Float wrapping with margin-box </figcaption> </figure> </div> <h2 class="heading settled" data-level="6" id="declaring-shapes"><span class="secno">6. </span><span class="content"> Declaring Shapes</span><a class="self-link" href="#declaring-shapes"></a></h2> <p>Shapes are declared with the <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside⑨">shape-outside</a> property, with possible modifications from the <a class="property css" data-link-type="property" href="#propdef-shape-margin" id="ref-for-propdef-shape-margin①">shape-margin</a> property. The shape defined by the <span class="property" id="ref-for-propdef-shape-outside①⓪">shape-outside</span> and <span class="property" id="ref-for-propdef-shape-margin②">shape-margin</span> properties changes the geometry of a float element’s <a data-link-type="dfn" href="#float-area" id="ref-for-float-area②⓪">float area</a>.</p> <h3 class="heading settled" data-level="6.1" id="shape-outside-property"><span class="secno">6.1. </span><span class="content"> Float Area Shape: the <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside①①">shape-outside</a> property</span><a class="self-link" href="#shape-outside-property"></a></h3> <table class="def propdef" data-link-for-hint="shape-outside"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-shape-outside">shape-outside</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod">none <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③">|</a> [ <a class="production css" data-link-type="type" href="#typedef-basic-shape" id="ref-for-typedef-basic-shape④" title="Expands to: circle() | ellipse() | inset() | path() | polygon() | rect() | reference box | xywh()"><basic-shape></a> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-any" id="ref-for-comb-any">||</a> <a class="production css" data-link-type="type" href="#typedef-shape-box" id="ref-for-typedef-shape-box②" title="Expands to: border-box | content-box | fill-box | margin-box | padding-box | stroke-box | svg viewport origin box | view-box"><shape-box></a> ] <span id="ref-for-comb-one④">|</span> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-images-3/#typedef-image" id="ref-for-typedef-image①"><image></a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>none <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td>floats <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>n/a <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>as <a href="#basic-shape-computed-values">defined</a> for <a class="production css" data-link-type="type" href="#typedef-basic-shape" id="ref-for-typedef-basic-shape⑤" title="Expands to: circle() | ellipse() | inset() | path() | polygon() | rect() | reference box | xywh()"><basic-shape></a> (with <a class="production css" data-link-type="type" href="#typedef-shape-box" id="ref-for-typedef-shape-box③" title="Expands to: border-box | content-box | fill-box | margin-box | padding-box | stroke-box | svg viewport origin box | view-box"><shape-box></a> following, if supplied); else the computed <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-images-3/#typedef-image" id="ref-for-typedef-image②"><image></a>; else the keyword as specified <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>as <a href="#basic-shape-interpolation">defined</a> for <a class="production css" data-link-type="type" href="#typedef-basic-shape" id="ref-for-typedef-basic-shape⑥" title="Expands to: circle() | ellipse() | inset() | path() | polygon() | rect() | reference box | xywh()"><basic-shape></a>, otherwise discrete </table> <p>The values of this property have the following meanings:</p> <dl> <dt><dfn class="dfn-paneled css" data-dfn-for="shape-outside" data-dfn-type="value" data-export id="valdef-shape-outside-none">none</dfn> <dd> The <a data-link-type="dfn" href="#float-area" id="ref-for-float-area②①">float area</a> is unaffected. <dt><a class="production css" data-link-type="type" href="#typedef-shape-box" id="ref-for-typedef-shape-box④" title="Expands to: border-box | content-box | fill-box | margin-box | padding-box | stroke-box | svg viewport origin box | view-box"><shape-box></a> <dd> If one of these values is specified by itself the shape is computed based on one of <a class="css" data-link-type="maybe" href="#valdef-shape-box-margin-box" id="ref-for-valdef-shape-box-margin-box④">margin-box</a>, <a class="css" data-link-type="maybe" href="#valdef-shape-box-border-box" id="ref-for-valdef-shape-box-border-box①">border-box</a>, <a class="css" data-link-type="maybe" href="#valdef-shape-box-padding-box" id="ref-for-valdef-shape-box-padding-box①">padding-box</a> or <a class="css" data-link-type="maybe" href="#valdef-shape-box-content-box" id="ref-for-valdef-shape-box-content-box①">content-box</a> which use their respective boxes including curvature from border-radius, similar to <a class="property css" data-link-type="property" href="https://www.w3.org/TR/css-backgrounds-3/#propdef-background-clip" id="ref-for-propdef-background-clip">background-clip</a> <a data-link-type="biblio" href="#biblio-css3bg">[CSS3BG]</a>. <dt><dfn class="css" data-dfn-for="shape-outside" data-dfn-type="value" data-export id="valdef-shape-outside-basic-shape"><a class="production css" data-link-type="type" href="#typedef-basic-shape" id="ref-for-typedef-basic-shape⑦" title="Expands to: circle() | ellipse() | inset() | path() | polygon() | rect() | reference box | xywh()"><basic-shape></a><a class="self-link" href="#valdef-shape-outside-basic-shape"></a></dfn> <dd> The shape is computed based on the values of one of <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-inset" id="ref-for-funcdef-basic-shape-inset③">inset()</a>, <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-circle" id="ref-for-funcdef-basic-shape-circle②">circle()</a>, <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-ellipse" id="ref-for-funcdef-basic-shape-ellipse②">ellipse()</a> or <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-polygon" id="ref-for-funcdef-basic-shape-polygon①">polygon()</a>. If a <a class="production css" data-link-type="type" href="#typedef-shape-box" id="ref-for-typedef-shape-box⑤" title="Expands to: border-box | content-box | fill-box | margin-box | padding-box | stroke-box | svg viewport origin box | view-box"><shape-box></a> is also supplied, this defines the <a data-link-type="dfn" href="#basic-shape-reference-box" id="ref-for-basic-shape-reference-box①⑥">reference box</a> for the <a class="production css" data-link-type="type" href="#typedef-basic-shape" id="ref-for-typedef-basic-shape⑧" title="Expands to: circle() | ellipse() | inset() | path() | polygon() | rect() | reference box | xywh()"><basic-shape></a> function. If <span class="production" id="ref-for-typedef-shape-box⑥" title="Expands to: border-box | content-box | fill-box | margin-box | padding-box | stroke-box | svg viewport origin box | view-box"><shape-box></span> is not supplied, then the <span id="ref-for-basic-shape-reference-box①⑦">reference box</span> defaults to <a class="css" data-link-type="maybe" href="#valdef-shape-box-margin-box" id="ref-for-valdef-shape-box-margin-box⑤">margin-box</a>. <dt><dfn class="css" data-dfn-for="shape-outside" data-dfn-type="value" data-export id="valdef-shape-outside-image"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-images-3/#typedef-image" id="ref-for-typedef-image③"><image></a><a class="self-link" href="#valdef-shape-outside-image"></a></dfn> <dd> The shape is extracted and computed based on the alpha channel of the specified <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-images-3/#typedef-image" id="ref-for-typedef-image④"><image></a> as defined by <a class="property css" data-link-type="property" href="#propdef-shape-image-threshold" id="ref-for-propdef-shape-image-threshold③">shape-image-threshold</a>. <p>User agents must use the <a href="https://fetch.spec.whatwg.org/#http-cors-protocol">CORS protocol</a> defined by the <a data-link-type="biblio" href="#biblio-fetch">[FETCH]</a> specification for all URLs in a <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside①②">shape-outside</a> value. When fetching, user agents must use "Anonymous" mode, set the referrer source to the stylesheet’s URL and set the origin to the URL of the containing document. If this results in network errors such that there is no valid fallback image, the effect is as if the value <a class="css" data-link-type="value" href="#valdef-shape-outside-none" id="ref-for-valdef-shape-outside-none">none</a> had been specified.</p> </dl> <h3 class="heading settled" data-level="6.2" id="shape-image-threshold-property"><span class="secno">6.2. </span><span class="content"> Choosing Image Pixels: the <a class="property css" data-link-type="property" href="#propdef-shape-image-threshold" id="ref-for-propdef-shape-image-threshold④">shape-image-threshold</a> property</span><a class="self-link" href="#shape-image-threshold-property"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-shape-image-threshold" id="ref-for-propdef-shape-image-threshold⑤">shape-image-threshold</a> defines the alpha channel threshold used to extract the shape using an image. A value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque.</p> <table class="def propdef" data-link-for-hint="shape-image-threshold"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-shape-image-threshold">shape-image-threshold</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-color-5/#typedef-alpha-value" id="ref-for-typedef-alpha-value"><alpha-value></a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>0 <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td>floats <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>n/a <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>specified number, clamped to the range [0,1] <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>by computed value </table> <p>The values of this property have the following meanings:</p> <dl> <dt><dfn class="css" data-dfn-for="shape-image-threshold" data-dfn-type="value" data-export id="valdef-shape-image-threshold-number"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#number-value" id="ref-for-number-value"><number></a><a class="self-link" href="#valdef-shape-image-threshold-number"></a></dfn> <dd> Sets the threshold used for extracting a shape from an image. The shape is defined by the pixels whose alpha value is greater than the threshold. A threshold value outside the range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this range. </dl> <p class="note" role="note"><span>Note:</span> A future level of CSS Shapes may define a switch to use the luminance data from an image instead of the alpha data. When this happens, shape-image-threshold will be extended to apply its threshold to either alpha or luminance, depending on the switch state.</p> <h3 class="heading settled" data-level="6.3" id="shape-margin-property"><span class="secno">6.3. </span><span class="content"> Expanding a Shape: the <a class="property css" data-link-type="property" href="#propdef-shape-margin" id="ref-for-propdef-shape-margin③">shape-margin</a> property</span><a class="self-link" href="#shape-margin-property"></a></h3> <p>The <a class="property css" data-link-type="property" href="#propdef-shape-margin" id="ref-for-propdef-shape-margin④">shape-margin</a> property adds a margin to a <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside①③">shape-outside</a>. This defines a new shape that is the smallest contour (in the shrink-wrap sense) that includes all the points that are the <span class="property" id="ref-for-propdef-shape-margin⑤">shape-margin</span> distance outward in the perpendicular direction from a point on the underlying shape. This includes any edge or line sections from the underlying shape. Note that at points where a perpendicular is not defined (e.g. sharp points or line ends) take all points on the circle centered at the point and with a radius of <span class="property" id="ref-for-propdef-shape-margin⑥">shape-margin</span>. This property takes only non-negative values.</p> <table class="def propdef" data-link-for-hint="shape-margin"> <tbody> <tr> <th>Name: <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-shape-margin">shape-margin</dfn> <tr class="value"> <th><a href="https://www.w3.org/TR/css-values/#value-defs">Value:</a> <td class="prod"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage①③"><length-percentage></a> <tr> <th><a href="https://www.w3.org/TR/css-cascade/#initial-values">Initial:</a> <td>0 <tr> <th><a href="https://www.w3.org/TR/css-cascade/#applies-to">Applies to:</a> <td>floats <tr> <th><a href="https://www.w3.org/TR/css-cascade/#inherited-property">Inherited:</a> <td>no <tr> <th><a href="https://www.w3.org/TR/css-values/#percentages">Percentages:</a> <td>refer to the <a data-link-type="dfn" href="https://www.w3.org/TR/css-writing-modes-4/#inline-size" id="ref-for-inline-size">inline size</a> of the containing block <tr> <th><a href="https://www.w3.org/TR/css-cascade/#computed">Computed value:</a> <td>computed <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage①④"><length-percentage></a> value <tr> <th><a href="https://www.w3.org/TR/cssom/#serializing-css-values">Canonical order:</a> <td>per grammar <tr> <th><a href="https://www.w3.org/TR/web-animations/#animation-type">Animation type:</a> <td>by computed value </table> <dl> <dt><dfn class="css" data-dfn-for="shape-margin" data-dfn-type="value" data-export id="valdef-shape-margin-length-percentage"><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage①⑤"><length-percentage></a><a class="self-link" href="#valdef-shape-margin-length-percentage"></a></dfn> <dd> Sets the margin of the shape to the specified value. </dl> <p class="note" role="note"><span>Note:</span> Adding a shape-margin does NOT allow a float area to extend outside a float’s margin box. Extra margin may need to be applied along with shape-margin to avoid clipping.</p> <div class="example" id="example-dde61751"> <a class="self-link" href="#example-dde61751"></a> <p>A <a class="property css" data-link-type="property" href="#propdef-shape-margin" id="ref-for-propdef-shape-margin⑦">shape-margin</a> creating an offset from a polygonal <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside①④">shape-outside</a>. The lighter blue area shows the shape in a 100x100px float, and the darker blue area shows the 10px offset.</p> <pre><code> .float { width: 100px; height: 100px; shape-outside: polygon(10px 10px, 90px 50px, 40px 50px, 90px 90px, 10px 90px); shape-margin: 10px; } </code></pre> <p><img alt="Example of a shape-margin offset" height="280" src="images/nepal-flag-shape.png" width="634"></p> </div> <div class="example" id="example-dc83070e"> <a class="self-link" href="#example-dc83070e"></a> <p>If shape-margin is added to the CSS logo from example 6, the line boxes <a data-link-type="dfn" href="#wrap" id="ref-for-wrap①③">wrapping</a> around the shape are shortened further. In case the image’s alpha channel runs up to the right edge of the image, some extra margin-right should be applied to ensure the shape is not clipped by the margin box.</p> <pre><code> #CSSlogo { shape-margin: 35px; margin-right: 35px; } </code></pre> <figure> <img alt="A float shape around an image using its alpha-channel with a 35 pixels shape-margin" height="251" src="images/shape-outside-image-with-margin.png" style="width:70%" width="634"> <figcaption> A float shape around an image using its alpha-channel with a 35-pixel <a class="property css" data-link-type="property" href="#propdef-shape-margin" id="ref-for-propdef-shape-margin⑧">shape-margin</a> </figcaption> </figure> </div> <h2 class="heading settled" data-level="7" id="privacy"><span class="secno">7. </span><span class="content">Privacy Considerations</span><a class="self-link" href="#privacy"></a></h2> <p>No privacy concerns have been raised against this specification.</p> <h2 class="heading settled" data-level="8" id="security"><span class="secno">8. </span><span class="content">Security Considerations</span><a class="self-link" href="#security"></a></h2> <p>Since the <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-images-3/#typedef-image" id="ref-for-typedef-image⑤"><image></a> value of <a class="property css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside①⑤">shape-outside</a> can expose some image data in a new way, use is limited to images with CORS approval.</p> <h2 class="no-num heading settled" id="acknowledgments"><span class="content"> Acknowledgments</span><a class="self-link" href="#acknowledgments"></a></h2> <p>This specification is made possible by input from Tab Atkins Jr., Amelia Bellamy-Royds, Andrei Bucur, Alexandru Chiculita, Boris Chiou, Emilio Cobos Álvarez, Elika Etemad, Arron Eicholz, Sylvain Galineau, Daniel Glazman, Arno Gourdol, Zoltan Horvath, Chris Jones, Bem Jones-Bey, Ian Kilpatrick, Ting-Yu Lin, Eric Meyer, Marcus Mielke, Alex Mogilevsky, Hans Muller, Mihnea Ovidenie, Virgil Palanciuc, Robert Sanderson, Dirk Schulze, Jen Simmons, Peter Sorotokin, Bear Travis, Eugene Veselov, Brad Werth, Stephen Zilles and the CSS Working Group members.</p> <h2 class="no-num heading settled" id="change-log"><span class="content"> Change Log</span><a class="self-link" href="#change-log"></a></h2> <h3 class="no-num heading settled" id="20140320"><span class="content"> Since <a href="https://www.w3.org/TR/2014/CR-css-shapes-1-20140320/">March 20th 2014</a></span><a class="self-link" href="#20140320"></a></h3> <ul> <li>Clarified shape-margin computed value <li>Clarified serialization of default position values, for <a href="https://github.com/w3c/csswg-drafts/issues/402">issue #402</a> <li>Clarified empty circles and ellipses for <a href="https://github.com/w3c/csswg-drafts/issues/850">issue #850</a> <li>Dropped the "Media:" entry from propdef tables, as with all CSS modules <li>Updated box model references from CSS 2 to CSS Box Model 3 <li>Updated Computed Value and Animation Type in propdef tables <li>Clarified computed value of shape-outside property, for <a href="https://github.com/w3c/csswg-drafts/issues/4042">issue #4042</a> <li>Clarified that shape-image-threshold can take a percentage value, like any alpha value, for <a href="https://github.com/w3c/csswg-drafts/issues/4102">issue #4102</a> <li>Moved path() back from level 2 <li>Added handling of negative margins for margin-box, for <a href="https://github.com/w3c/csswg-drafts/issues/675">issue #675</a> <li>Removed special-case serialization of position values, for <a href="https://github.com/w3c/csswg-drafts/issues/2301">issue #2301</a> <li>Added clarifications to shape-margin examples <li>Added margin=0 case for margin-box shape, for <a href="https://github.com/w3c/csswg-drafts/issues/675">issue #675</a> <li>Changed rules about degenerate shapes to use shape edges, for <a href="https://github.com/w3c/csswg-drafts/issues/2375">issue #2375</a> <li>Clarified that invalid path strings make the <a class="css" data-link-type="maybe" href="#funcdef-basic-shape-path" id="ref-for-funcdef-basic-shape-path①">path()</a> invalid, for <a href="https://github.com/w3c/fxtf-drafts/issues/392">issue #392</a> <li>Rewrote definition of inset rectangles, added auto value, added examples <li>Clarified computed value of basic shape rect functions <li>Assorted markup fixes, including use of range notation and exporting defined terms for use in other specifications <li>Split Privacy and Security considerations into separate sections </ul> <h3 class="no-num heading settled" id="20140211"><span class="content"> Since <a href="https://www.w3.org/TR/2014/WD-css-shapes-1-20140211/">February 11th 2014</a></span><a class="self-link" href="#20140211"></a></h3> <ul> <li>Replaced divs with images in the first example <li>Add 0px to last serialization example </ul> <h3 class="no-num heading settled" id="20131203"><span class="content"> Since <a href="https://www.w3.org/TR/2013/WD-css-shapes-1-20131203/">December 3rd 2013</a></span><a class="self-link" href="#20131203"></a></h3> <ul> <li>Updated computed value and serialization of basic shapes <li>Added a margin-box example <li>Change auto to none for shape-outside <li>Defined shape-box instead of redefining box <li>Clarified that shape from image may produce more than one path </ul> <h3 class="no-num heading settled" id="20130620"><span class="content"> Since <a href="https://www.w3.org/TR/2013/WD-css-shapes-1-20130620/">June 20th 2013</a></span><a class="self-link" href="#20130620"></a></h3> <ul> <li>Added shape from box value section <li>Updated basic-shape interpolation <li>Allow negative insets, disallow negative radii <li>Changed relevant to reference <li>Remove box-sizing dependency, add relevant box keywords <li>Changed circle() and ellipse() to use radial gradient syntax <li>Postponed rectangle() to level 2 <li>Clarified shape-from-image sizing and positioning <li>Change inset-rectangle() to inset() <li>Future-proof shape-image-threshold to possibly apply to luminance <li>Added CORS fetching to shape-outside URLs <li>Changed shape-outside value from <uri> to <image> <li>Remove 'percentages based on auto-sizing resolve to 0' <li>Change initial value of shape-image-threshold to 0.0 <li>Change float positioning to be unaffected by shape-outside <li>Shapes on floats clipped to float’s margin box </ul> <h3 class="no-num heading settled" id="20120503"><span class="content"> Since <a href="https://www.w3.org/TR/2012/WD-css3-exclusions-20120503/">May 3rd 2012</a></span><a class="self-link" href="#20120503"></a></h3> <ul> <li>Postpone shapes from SVG elements to a future Shapes level <li>Postpone shape-inside to a future Shapes level <li>split exclusions from shapes into separate modules <li>added inset-rectangle() to basic shapes <li>Changed shape-inside overflow diagrams to show exclusion behavior <li>Changed shape-inside to contribute to the wrapping context <li>Defined exclusion edges relative to wrapping content’s writing mode <li>Made use of start, end, before and after consistent <li>Added interpolation for basic shapes <li>Changed basic shapes to depend on box specified with box-sizing <li>Added overflow behavior for shape-inside. <li>Added wrap-flow:minimum. <li>Clarified processing model. <li>Changed wrap-margin and wrap-padding to shape-margin and shape-padding. <li>Removed wrap shorthand. </ul> <h3 class="no-num heading settled" id="20111213"><span class="content"> Since <a href="https://www.w3.org/TR/2011/WD-css3-exclusions-20111213/">December 13th 2011</a></span><a class="self-link" href="#20111213"></a></h3> <ul> <li>Clarified processing model. <li>Clarified interaction with floats. <li>Clarified that an exclusion element establishes a new block formatting context. </ul> </main> <h2 class="no-ref no-num heading settled" id="w3c-conformance"><span class="content"> Conformance</span><a class="self-link" href="#w3c-conformance"></a></h2> <h3 class="no-ref heading settled" id="w3c-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#w3c-conventions"></a></h3> <p>Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification. </p> <p>All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a></p> <p>Examples in this specification are introduced with the words “for example” or are set apart from the normative text with <code>class="example"</code>, like this: </p> <div class="example" id="w3c-example"> <a class="self-link" href="#w3c-example"></a> <p>This is an example of an informative example.</p> </div> <p>Informative notes begin with the word “Note” and are set apart from the normative text with <code>class="note"</code>, like this: </p> <p class="note" role="note">Note, this is an informative note.</p> <p>Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <code><strong class="advisement"></code>, like this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong></p> <h3 class="no-ref heading settled" id="w3c-conformance-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#w3c-conformance-classes"></a></h3> <p>Conformance to this specification is defined for three conformance classes: </p> <dl> <dt>style sheet <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS style sheet</a>. <dt>renderer <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders documents that use them. <dt>authoring tool <dd>A <a href="https://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> that writes a style sheet. </dl> <p>A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module. </p> <p>A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.) </p> <p>An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module. </p> <h3 class="no-ref heading settled" id="w3c-partial"><span class="content"> Partial implementations</span><a class="self-link" href="#w3c-partial"></a></h3> <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers <strong>must</strong> treat as invalid (and <a href="https://www.w3.org/TR/CSS21/conform.html#ignore">ignore as appropriate</a>) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents <strong>must not</strong> selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.</p> <h4 class="heading settled" id="w3c-conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#w3c-conform-future-proofing"></a></h4> <p>To avoid clashes with future stable CSS features, the CSSWG recommends <a href="https://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="https://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="https://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p> <h3 class="no-ref heading settled" id="w3c-testing"><span class="content"> Non-experimental implementations</span><a class="self-link" href="#w3c-testing"></a></h3> <p>Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec. </p> <p>To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group. </p> <p>Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at <a href="https://www.w3.org/Style/CSS/Test/">https://www.w3.org/Style/CSS/Test/</a>. Questions should be directed to the <a href="https://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list.</p> <h3 class="no-ref heading settled" id="w3c-cr-exit-criteria"><span class="content"> CR exit criteria</span><a class="self-link" href="#w3c-cr-exit-criteria"></a></h3> <p> For this specification to be advanced to Proposed Recommendation, there must be at least two independent, interoperable implementations of each feature. Each feature may be implemented by a different set of products, there is no requirement that all features be implemented by a single product. For the purposes of this criterion, we define the following terms: </p> <dl> <dt>independent <dd>each implementation must be developed by a different party and cannot share, reuse, or derive from code used by another qualifying implementation. Sections of code that have no bearing on the implementation of this specification are exempt from this requirement. <dt>interoperable <dd>passing the respective test case(s) in the official CSS test suite, or, if the implementation is not a Web browser, an equivalent test. Every relevant test in the test suite should have an equivalent test created if such a user agent (UA) is to be used to claim interoperability. In addition if such a UA is to be used to claim interoperability, then there must one or more additional UAs which can also pass those equivalent tests in the same way for the purpose of interoperability. The equivalent tests must be made publicly available for the purposes of peer review. <dt>implementation <dd> a user agent which: <ol class="inline"> <li>implements the specification. <li>is available to the general public. The implementation may be a shipping product or other publicly available version (i.e., beta version, preview release, or "nightly build"). Non-shipping product releases must have implemented the feature(s) for a period of at least one month in order to demonstrate stability. <li>is not experimental (i.e., a version specifically designed to pass the test suite and is not intended for normal usage going forward). </ol> </dl> <p>The specification will remain Candidate Recommendation for at least six months.</p> <script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script> <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2> <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3> <ul class="index"> <li> <basic-shape> <ul> <li><a href="#typedef-basic-shape">(type)</a><span>, in § 3</span> <li><a href="#valdef-shape-outside-basic-shape">value for shape-outside</a><span>, in § 6.1</span> </ul> <li><a href="#typedef-basic-shape-rect"><basic-shape-rect></a><span>, in § 3.1</span> <li><a href="#valdef-shape-box-border-box">border-box</a><span>, in § 5</span> <li><a href="#funcdef-basic-shape-circle">circle()</a><span>, in § 3.1</span> <li><a href="#closest-side">closest-side</a><span>, in § 3.1</span> <li><a href="#valdef-shape-box-content-box">content-box</a><span>, in § 5</span> <li><a href="#funcdef-basic-shape-ellipse">ellipse()</a><span>, in § 3.1</span> <li><a href="#farthest-side">farthest-side</a><span>, in § 3.1</span> <li><a href="#float-area">Float area</a><span>, in § 1.4</span> <li><a href="#valdef-shape-outside-image"><image></a><span>, in § 6.1</span> <li><a href="#funcdef-basic-shape-inset">inset()</a><span>, in § 3.1</span> <li><a href="#valdef-shape-margin-length-percentage"><length-percentage></a><span>, in § 6.3</span> <li><a href="#valdef-shape-box-margin-box">margin-box</a><span>, in § 5</span> <li><a href="#valdef-shape-outside-none">none</a><span>, in § 6.1</span> <li><a href="#valdef-shape-image-threshold-number"><number></a><span>, in § 6.2</span> <li><a href="#valdef-shape-box-padding-box">padding-box</a><span>, in § 5</span> <li><a href="#funcdef-basic-shape-path">path()</a><span>, in § 3.1</span> <li><a href="#funcdef-basic-shape-polygon">polygon()</a><span>, in § 3.1</span> <li><a href="#funcdef-basic-shape-rect">rect()</a><span>, in § 3.1</span> <li><a href="#basic-shape-reference-box">reference box</a><span>, in § 3</span> <li><a href="#typedef-shape-box"><shape-box></a><span>, in § 5</span> <li><a href="#propdef-shape-image-threshold">shape-image-threshold</a><span>, in § 6.2</span> <li><a href="#propdef-shape-margin">shape-margin</a><span>, in § 6.3</span> <li><a href="#propdef-shape-outside">shape-outside</a><span>, in § 6.1</span> <li><a href="#typedef-shape-radius"><shape-radius></a><span>, in § 3.1</span> <li><a href="#valdef-path-string"><string></a><span>, in § 3.1</span> <li><a href="#wrap">wrap</a><span>, in § 1.4</span> <li><a href="#wrap">wrapping</a><span>, in § 1.4</span> <li><a href="#funcdef-basic-shape-xywh">xywh()</a><span>, in § 3.1</span> </ul> <aside class="dfn-panel" data-for="term-for-margin-box"> <a href="https://www.w3.org/TR/css-box-4/#margin-box">https://www.w3.org/TR/css-box-4/#margin-box</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-margin-box">1.4. Terminology</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-alpha-value"> <a href="https://www.w3.org/TR/css-color-5/#typedef-alpha-value">https://www.w3.org/TR/css-color-5/#typedef-alpha-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-alpha-value">6.2. Choosing Image Pixels: the shape-image-threshold property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-image"> <a href="https://www.w3.org/TR/css-images-3/#typedef-image">https://www.w3.org/TR/css-images-3/#typedef-image</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-image">4. Shapes from Image</a> <li><a href="#ref-for-typedef-image①">6.1. Float Area Shape: the shape-outside property</a> <a href="#ref-for-typedef-image②">(2)</a> <a href="#ref-for-typedef-image③">(3)</a> <a href="#ref-for-typedef-image④">(4)</a> <li><a href="#ref-for-typedef-image⑤">8. Security Considerations</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-clip"> <a href="https://www.w3.org/TR/css-masking-1/#propdef-clip">https://www.w3.org/TR/css-masking-1/#propdef-clip</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-clip">3.1. Supported Shapes</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-clip-path"> <a href="https://www.w3.org/TR/css-masking-1/#propdef-clip-path">https://www.w3.org/TR/css-masking-1/#propdef-clip-path</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-clip-path">3.1. Supported Shapes</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-valdef-clip-rule-evenodd"> <a href="https://www.w3.org/TR/css-masking-1/#valdef-clip-rule-evenodd">https://www.w3.org/TR/css-masking-1/#valdef-clip-rule-evenodd</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-clip-rule-evenodd">3.1. Supported Shapes</a> <a href="#ref-for-valdef-clip-rule-evenodd①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-valdef-clip-rule-nonzero"> <a href="https://www.w3.org/TR/css-masking-1/#valdef-clip-rule-nonzero">https://www.w3.org/TR/css-masking-1/#valdef-clip-rule-nonzero</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-clip-rule-nonzero">3.1. Supported Shapes</a> <a href="#ref-for-valdef-clip-rule-nonzero①">(2)</a> <a href="#ref-for-valdef-clip-rule-nonzero②">(3)</a> <a href="#ref-for-valdef-clip-rule-nonzero③">(4)</a> <li><a href="#ref-for-valdef-clip-rule-nonzero④">3.4. Interpolation of Basic Shapes</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-css-invalid"> <a href="https://www.w3.org/TR/css-syntax-3/#css-invalid">https://www.w3.org/TR/css-syntax-3/#css-invalid</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-invalid">3.1. Supported Shapes</a> <a href="#ref-for-css-invalid①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-length-percentage"> <a href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage">https://www.w3.org/TR/css-values-4/#typedef-length-percentage</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-length-percentage">3.1. Supported Shapes</a> <a href="#ref-for-typedef-length-percentage①">(2)</a> <a href="#ref-for-typedef-length-percentage②">(3)</a> <a href="#ref-for-typedef-length-percentage③">(4)</a> <a href="#ref-for-typedef-length-percentage④">(5)</a> <a href="#ref-for-typedef-length-percentage⑤">(6)</a> <a href="#ref-for-typedef-length-percentage⑥">(7)</a> <a href="#ref-for-typedef-length-percentage⑦">(8)</a> <a href="#ref-for-typedef-length-percentage⑧">(9)</a> <a href="#ref-for-typedef-length-percentage⑨">(10)</a> <a href="#ref-for-typedef-length-percentage①⓪">(11)</a> <li><a href="#ref-for-typedef-length-percentage①①">3.2. Computed Values of Basic Shapes</a> <a href="#ref-for-typedef-length-percentage①②">(2)</a> <li><a href="#ref-for-typedef-length-percentage①③">6.3. Expanding a Shape: the shape-margin property</a> <a href="#ref-for-typedef-length-percentage①④">(2)</a> <a href="#ref-for-typedef-length-percentage①⑤">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-number-value"> <a href="https://www.w3.org/TR/css-values-4/#number-value">https://www.w3.org/TR/css-values-4/#number-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-number-value">6.2. Choosing Image Pixels: the shape-image-threshold property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-position"> <a href="https://www.w3.org/TR/css-values-4/#typedef-position">https://www.w3.org/TR/css-values-4/#typedef-position</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-position">3.1. Supported Shapes</a> <a href="#ref-for-typedef-position①">(2)</a> <li><a href="#ref-for-typedef-position②">3.2. Computed Values of Basic Shapes</a> <li><a href="#ref-for-typedef-position③">3.3. Serialization of Basic Shapes</a> <a href="#ref-for-typedef-position④">(2)</a> <a href="#ref-for-typedef-position⑤">(3)</a> <a href="#ref-for-typedef-position⑥">(4)</a> <a href="#ref-for-typedef-position⑦">(5)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-string-value"> <a href="https://www.w3.org/TR/css-values-4/#string-value">https://www.w3.org/TR/css-values-4/#string-value</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-string-value">3.1. Supported Shapes</a> <a href="#ref-for-string-value①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-css-wide-keywords"> <a href="https://www.w3.org/TR/css-values-4/#css-wide-keywords">https://www.w3.org/TR/css-values-4/#css-wide-keywords</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-css-wide-keywords">1.2. Values</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-comb-one"> <a href="https://www.w3.org/TR/css-values-4/#comb-one">https://www.w3.org/TR/css-values-4/#comb-one</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-comb-one">3.1. Supported Shapes</a> <a href="#ref-for-comb-one①">(2)</a> <li><a href="#ref-for-comb-one②">5. Shapes from Box Values</a> <li><a href="#ref-for-comb-one③">6.1. Float Area Shape: the shape-outside property</a> <a href="#ref-for-comb-one④">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-comb-any"> <a href="https://www.w3.org/TR/css-values-4/#comb-any">https://www.w3.org/TR/css-values-4/#comb-any</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-comb-any">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-inline-size"> <a href="https://www.w3.org/TR/css-writing-modes-4/#inline-size">https://www.w3.org/TR/css-writing-modes-4/#inline-size</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-inline-size">6.3. Expanding a Shape: the shape-margin property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-margin"> <a href="https://www.w3.org/TR/CSS2/box.html#propdef-margin">https://www.w3.org/TR/CSS2/box.html#propdef-margin</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-margin">3.1. Supported Shapes</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-typedef-box"> <a href="https://www.w3.org/TR/css-backgrounds-3/#typedef-box">https://www.w3.org/TR/css-backgrounds-3/#typedef-box</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-box">5. Shapes from Box Values</a> <a href="#ref-for-typedef-box①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-background-clip"> <a href="https://www.w3.org/TR/css-backgrounds-3/#propdef-background-clip">https://www.w3.org/TR/css-backgrounds-3/#propdef-background-clip</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-background-clip">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-propdef-border-radius"> <a href="https://www.w3.org/TR/css-backgrounds-3/#propdef-border-radius">https://www.w3.org/TR/css-backgrounds-3/#propdef-border-radius</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-border-radius">3.1. Supported Shapes</a> <a href="#ref-for-propdef-border-radius①">(2)</a> <a href="#ref-for-propdef-border-radius②">(3)</a> <a href="#ref-for-propdef-border-radius③">(4)</a> <a href="#ref-for-propdef-border-radius④">(5)</a> <a href="#ref-for-propdef-border-radius⑤">(6)</a> <a href="#ref-for-propdef-border-radius⑥">(7)</a> <a href="#ref-for-propdef-border-radius⑦">(8)</a> <a href="#ref-for-propdef-border-radius⑧">(9)</a> <li><a href="#ref-for-propdef-border-radius⑨">3.2. Computed Values of Basic Shapes</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-FillRuleProperty"> <a href="https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty">https://www.w3.org/TR/SVG2/painting.html#FillRuleProperty</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-FillRuleProperty">3.1. Supported Shapes</a> <a href="#ref-for-FillRuleProperty①">(2)</a> <a href="#ref-for-FillRuleProperty②">(3)</a> <a href="#ref-for-FillRuleProperty③">(4)</a> <li><a href="#ref-for-FillRuleProperty④">3.4. Interpolation of Basic Shapes</a> </ul> </aside> <aside class="dfn-panel" data-for="term-for-TermViewBox"> <a href="https://www.w3.org/TR/SVG2/coords.html#TermViewBox">https://www.w3.org/TR/SVG2/coords.html#TermViewBox</a><b>Referenced in:</b> <ul> <li><a href="#ref-for-TermViewBox">3.1. Supported Shapes</a> </ul> </aside> <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3> <ul class="index"> <li> <a data-link-type="biblio">[CSS-BOX-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-margin-box">margin box</span> </ul> <li> <a data-link-type="biblio">[CSS-COLOR-5]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-typedef-alpha-value"><alpha-value></span> </ul> <li> <a data-link-type="biblio">[CSS-IMAGES-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-typedef-image"><image></span> </ul> <li> <a data-link-type="biblio">[CSS-MASKING]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-propdef-clip">clip</span> <li><span class="dfn-paneled" id="term-for-propdef-clip-path">clip-path</span> <li><span class="dfn-paneled" id="term-for-valdef-clip-rule-evenodd">evenodd</span> <li><span class="dfn-paneled" id="term-for-valdef-clip-rule-nonzero">nonzero</span> </ul> <li> <a data-link-type="biblio">[CSS-SYNTAX-3]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-css-invalid">invalid</span> </ul> <li> <a data-link-type="biblio">[CSS-VALUES-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-typedef-length-percentage"><length-percentage></span> <li><span class="dfn-paneled" id="term-for-number-value"><number></span> <li><span class="dfn-paneled" id="term-for-typedef-position"><position></span> <li><span class="dfn-paneled" id="term-for-string-value"><string></span> <li><span class="dfn-paneled" id="term-for-css-wide-keywords">css-wide keywords</span> <li><span class="dfn-paneled" id="term-for-comb-one">|</span> <li><span class="dfn-paneled" id="term-for-comb-any">||</span> </ul> <li> <a data-link-type="biblio">[CSS-WRITING-MODES-4]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-inline-size">inline size</span> </ul> <li> <a data-link-type="biblio">[CSS2]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-propdef-margin">margin</span> </ul> <li> <a data-link-type="biblio">[CSS3BG]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-typedef-box"><box></span> <li><span class="dfn-paneled" id="term-for-propdef-background-clip">background-clip</span> <li><span class="dfn-paneled" id="term-for-propdef-border-radius">border-radius</span> </ul> <li> <a data-link-type="biblio">[SVG2]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="term-for-FillRuleProperty">fill-rule</span> <li><span class="dfn-paneled" id="term-for-TermViewBox">viewbox</span> </ul> </ul> <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2> <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3> <dl> <dt id="biblio-css-box-4">[CSS-BOX-4] <dd>Elika Etemad. <a href="https://www.w3.org/TR/css-box-4/"><cite>CSS Box Model Module Level 4</cite></a>. 21 April 2020. WD. URL: <a href="https://www.w3.org/TR/css-box-4/">https://www.w3.org/TR/css-box-4/</a> <dt id="biblio-css-color-5">[CSS-COLOR-5] <dd>Chris Lilley; et al. <a href="https://www.w3.org/TR/css-color-5/"><cite>CSS Color Module Level 5</cite></a>. 28 June 2022. WD. URL: <a href="https://www.w3.org/TR/css-color-5/">https://www.w3.org/TR/css-color-5/</a> <dt id="biblio-css-images-3">[CSS-IMAGES-3] <dd>Tab Atkins Jr.; Elika Etemad; Lea Verou. <a href="https://www.w3.org/TR/css-images-3/"><cite>CSS Images Module Level 3</cite></a>. 17 December 2020. CR. URL: <a href="https://www.w3.org/TR/css-images-3/">https://www.w3.org/TR/css-images-3/</a> <dt id="biblio-css-masking">[CSS-MASKING] <dd>Dirk Schulze; Brian Birtles; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-masking-1/"><cite>CSS Masking Module Level 1</cite></a>. 5 August 2021. CR. URL: <a href="https://www.w3.org/TR/css-masking-1/">https://www.w3.org/TR/css-masking-1/</a> <dt id="biblio-css-syntax-3">[CSS-SYNTAX-3] <dd>Tab Atkins Jr.; Simon Sapin. <a href="https://www.w3.org/TR/css-syntax-3/"><cite>CSS Syntax Module Level 3</cite></a>. 24 December 2021. CR. URL: <a href="https://www.w3.org/TR/css-syntax-3/">https://www.w3.org/TR/css-syntax-3/</a> <dt id="biblio-css-values-3">[CSS-VALUES-3] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-3/"><cite>CSS Values and Units Module Level 3</cite></a>. 6 June 2019. CR. URL: <a href="https://www.w3.org/TR/css-values-3/">https://www.w3.org/TR/css-values-3/</a> <dt id="biblio-css-values-4">[CSS-VALUES-4] <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-4/"><cite>CSS Values and Units Module Level 4</cite></a>. 19 October 2022. WD. URL: <a href="https://www.w3.org/TR/css-values-4/">https://www.w3.org/TR/css-values-4/</a> <dt id="biblio-css-writing-modes-4">[CSS-WRITING-MODES-4] <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-writing-modes-4/"><cite>CSS Writing Modes Level 4</cite></a>. 30 July 2019. CR. URL: <a href="https://www.w3.org/TR/css-writing-modes-4/">https://www.w3.org/TR/css-writing-modes-4/</a> <dt id="biblio-css2">[CSS2] <dd>Bert Bos; et al. <a href="https://www.w3.org/TR/CSS21/"><cite>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</cite></a>. 7 June 2011. REC. URL: <a href="https://www.w3.org/TR/CSS21/">https://www.w3.org/TR/CSS21/</a> <dt id="biblio-css3bg">[CSS3BG] <dd>Bert Bos; Elika Etemad; Brad Kemper. <a href="https://www.w3.org/TR/css-backgrounds-3/"><cite>CSS Backgrounds and Borders Module Level 3</cite></a>. 26 July 2021. CR. URL: <a href="https://www.w3.org/TR/css-backgrounds-3/">https://www.w3.org/TR/css-backgrounds-3/</a> <dt id="biblio-css3box">[CSS3BOX] <dd>Elika Etemad. <a href="https://www.w3.org/TR/css-box-3/"><cite>CSS Box Model Module Level 3</cite></a>. 22 December 2020. CR. URL: <a href="https://www.w3.org/TR/css-box-3/">https://www.w3.org/TR/css-box-3/</a> <dt id="biblio-fetch">[FETCH] <dd>Anne van Kesteren. <a href="https://fetch.spec.whatwg.org/"><cite>Fetch Standard</cite></a>. Living Standard. URL: <a href="https://fetch.spec.whatwg.org/">https://fetch.spec.whatwg.org/</a> <dt id="biblio-rfc2119">[RFC2119] <dd>S. Bradner. <a href="https://datatracker.ietf.org/doc/html/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. March 1997. Best Current Practice. URL: <a href="https://datatracker.ietf.org/doc/html/rfc2119">https://datatracker.ietf.org/doc/html/rfc2119</a> <dt id="biblio-svg2">[SVG2] <dd>Amelia Bellamy-Royds; et al. <a href="https://www.w3.org/TR/SVG2/"><cite>Scalable Vector Graphics (SVG) 2</cite></a>. 4 October 2018. CR. URL: <a href="https://www.w3.org/TR/SVG2/">https://www.w3.org/TR/SVG2/</a> </dl> <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3> <dl> <dt id="biblio-css3-exclusions">[CSS3-EXCLUSIONS] <dd>Rossen Atanassov; Vincent Hardy; Alan Stearns. <a href="https://www.w3.org/TR/css3-exclusions/"><cite>CSS Exclusions Module Level 1</cite></a>. 15 January 2015. WD. URL: <a href="https://www.w3.org/TR/css3-exclusions/">https://www.w3.org/TR/css3-exclusions/</a> </dl> <h2 class="no-num no-ref heading settled" id="property-index"><span class="content">Property Index</span><a class="self-link" href="#property-index"></a></h2> <div class="big-element-wrapper"> <table class="index"> <thead> <tr> <th scope="col">Name <th scope="col">Value <th scope="col">Initial <th scope="col">Applies to <th scope="col">Inh. <th scope="col">%ages <th scope="col">Animation type <th scope="col">Canonical order <th scope="col">Computed value <tbody> <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-shape-image-threshold" id="ref-for-propdef-shape-image-threshold⑥">shape-image-threshold</a> <td><alpha-value> <td>0 <td>floats <td>no <td>n/a <td>by computed value <td>per grammar <td>specified number, clamped to the range [0,1] <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-shape-margin" id="ref-for-propdef-shape-margin⑨">shape-margin</a> <td><length-percentage> <td>0 <td>floats <td>no <td>refer to the inline size of the containing block <td>by computed value <td>per grammar <td>computed <length-percentage> value <tr> <th scope="row"><a class="css" data-link-type="property" href="#propdef-shape-outside" id="ref-for-propdef-shape-outside①⑥">shape-outside</a> <td>none | [ <basic-shape> || <shape-box> ] | <image> <td>none <td>floats <td>no <td>n/a <td>as defined for <basic-shape>, otherwise discrete <td>per grammar <td>as defined for <basic-shape> (with <shape-box> following, if supplied); else the computed <image>; else the keyword as specified </table> </div> <aside class="dfn-panel" data-for="wrap"> <b><a href="#wrap">#wrap</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-wrap①">1. Introduction</a> <li><a href="#ref-for-wrap②">1.4. Terminology</a> <a href="#ref-for-wrap③">(2)</a> <a href="#ref-for-wrap④">(3)</a> <a href="#ref-for-wrap⑤">(4)</a> <a href="#ref-for-wrap⑥">(5)</a> <li><a href="#ref-for-wrap⑦">2. Relation to the box model and float behavior</a> <a href="#ref-for-wrap⑧">(2)</a> <a href="#ref-for-wrap⑨">(3)</a> <a href="#ref-for-wrap①⓪">(4)</a> <a href="#ref-for-wrap①①">(5)</a> <a href="#ref-for-wrap①②">(6)</a> <li><a href="#ref-for-wrap①③">6.3. Expanding a Shape: the shape-margin property</a> </ul> </aside> <aside class="dfn-panel" data-for="float-area"> <b><a href="#float-area">#float-area</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-float-area">1. Introduction</a> <a href="#ref-for-float-area①">(2)</a> <li><a href="#ref-for-float-area②">1.4. Terminology</a> <a href="#ref-for-float-area③">(2)</a> <a href="#ref-for-float-area④">(3)</a> <a href="#ref-for-float-area⑤">(4)</a> <a href="#ref-for-float-area⑥">(5)</a> <a href="#ref-for-float-area⑦">(6)</a> <li><a href="#ref-for-float-area⑧">2. Relation to the box model and float behavior</a> <a href="#ref-for-float-area⑨">(2)</a> <a href="#ref-for-float-area①⓪">(3)</a> <a href="#ref-for-float-area①①">(4)</a> <a href="#ref-for-float-area①②">(5)</a> <a href="#ref-for-float-area①③">(6)</a> <a href="#ref-for-float-area①④">(7)</a> <a href="#ref-for-float-area①⑤">(8)</a> <a href="#ref-for-float-area①⑥">(9)</a> <a href="#ref-for-float-area①⑦">(10)</a> <li><a href="#ref-for-float-area①⑧">4. Shapes from Image</a> <a href="#ref-for-float-area①⑨">(2)</a> <li><a href="#ref-for-float-area②⓪">6. Declaring Shapes</a> <li><a href="#ref-for-float-area②①">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-basic-shape"> <b><a href="#typedef-basic-shape">#typedef-basic-shape</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-basic-shape">3. Basic Shapes</a> <li><a href="#ref-for-typedef-basic-shape①">3.1. Supported Shapes</a> <li><a href="#ref-for-typedef-basic-shape②">3.2. Computed Values of Basic Shapes</a> <li><a href="#ref-for-typedef-basic-shape③">3.3. Serialization of Basic Shapes</a> <li><a href="#ref-for-typedef-basic-shape④">6.1. Float Area Shape: the shape-outside property</a> <a href="#ref-for-typedef-basic-shape⑤">(2)</a> <a href="#ref-for-typedef-basic-shape⑥">(3)</a> <a href="#ref-for-typedef-basic-shape⑦">(4)</a> <a href="#ref-for-typedef-basic-shape⑧">(5)</a> </ul> </aside> <aside class="dfn-panel" data-for="basic-shape-reference-box"> <b><a href="#basic-shape-reference-box">#basic-shape-reference-box</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-basic-shape-reference-box">3. Basic Shapes</a> <a href="#ref-for-basic-shape-reference-box①">(2)</a> <li><a href="#ref-for-basic-shape-reference-box②">3.1. Supported Shapes</a> <a href="#ref-for-basic-shape-reference-box③">(2)</a> <a href="#ref-for-basic-shape-reference-box④">(3)</a> <a href="#ref-for-basic-shape-reference-box⑤">(4)</a> <a href="#ref-for-basic-shape-reference-box⑥">(5)</a> <a href="#ref-for-basic-shape-reference-box⑦">(6)</a> <a href="#ref-for-basic-shape-reference-box⑧">(7)</a> <a href="#ref-for-basic-shape-reference-box⑨">(8)</a> <a href="#ref-for-basic-shape-reference-box①⓪">(9)</a> <a href="#ref-for-basic-shape-reference-box①①">(10)</a> <a href="#ref-for-basic-shape-reference-box①②">(11)</a> <a href="#ref-for-basic-shape-reference-box①③">(12)</a> <a href="#ref-for-basic-shape-reference-box①④">(13)</a> <li><a href="#ref-for-basic-shape-reference-box①⑤">3.4. Interpolation of Basic Shapes</a> <li><a href="#ref-for-basic-shape-reference-box①⑥">6.1. Float Area Shape: the shape-outside property</a> <a href="#ref-for-basic-shape-reference-box①⑦">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-basic-shape-inset"> <b><a href="#funcdef-basic-shape-inset">#funcdef-basic-shape-inset</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-basic-shape-inset">3.1. Supported Shapes</a> <li><a href="#ref-for-funcdef-basic-shape-inset①">3.2. Computed Values of Basic Shapes</a> <li><a href="#ref-for-funcdef-basic-shape-inset②">3.4. Interpolation of Basic Shapes</a> <li><a href="#ref-for-funcdef-basic-shape-inset③">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-basic-shape-xywh"> <b><a href="#funcdef-basic-shape-xywh">#funcdef-basic-shape-xywh</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-basic-shape-xywh">3.1. Supported Shapes</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-basic-shape-rect"> <b><a href="#funcdef-basic-shape-rect">#funcdef-basic-shape-rect</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-basic-shape-rect">3.1. Supported Shapes</a> <a href="#ref-for-funcdef-basic-shape-rect①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-basic-shape-circle"> <b><a href="#funcdef-basic-shape-circle">#funcdef-basic-shape-circle</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-basic-shape-circle">3.2. Computed Values of Basic Shapes</a> <li><a href="#ref-for-funcdef-basic-shape-circle①">3.4. Interpolation of Basic Shapes</a> <li><a href="#ref-for-funcdef-basic-shape-circle②">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-basic-shape-ellipse"> <b><a href="#funcdef-basic-shape-ellipse">#funcdef-basic-shape-ellipse</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-basic-shape-ellipse">3.2. Computed Values of Basic Shapes</a> <li><a href="#ref-for-funcdef-basic-shape-ellipse①">3.4. Interpolation of Basic Shapes</a> <li><a href="#ref-for-funcdef-basic-shape-ellipse②">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-basic-shape-polygon"> <b><a href="#funcdef-basic-shape-polygon">#funcdef-basic-shape-polygon</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-basic-shape-polygon">3.4. Interpolation of Basic Shapes</a> <li><a href="#ref-for-funcdef-basic-shape-polygon①">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="funcdef-basic-shape-path"> <b><a href="#funcdef-basic-shape-path">#funcdef-basic-shape-path</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-funcdef-basic-shape-path">3.1. Supported Shapes</a> <li><a href="#ref-for-funcdef-basic-shape-path①"> Since March 20th 2014</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-shape-radius"> <b><a href="#typedef-shape-radius">#typedef-shape-radius</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-shape-radius">3.1. Supported Shapes</a> <a href="#ref-for-typedef-shape-radius①">(2)</a> <a href="#ref-for-typedef-shape-radius②">(3)</a> </ul> </aside> <aside class="dfn-panel" data-for="closest-side"> <b><a href="#closest-side">#closest-side</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-closest-side">3.4. Interpolation of Basic Shapes</a> </ul> </aside> <aside class="dfn-panel" data-for="farthest-side"> <b><a href="#farthest-side">#farthest-side</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-farthest-side">3.4. Interpolation of Basic Shapes</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-basic-shape-rect"> <b><a href="#typedef-basic-shape-rect">#typedef-basic-shape-rect</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-basic-shape-rect">3.2. Computed Values of Basic Shapes</a> <a href="#ref-for-typedef-basic-shape-rect①">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="typedef-shape-box"> <b><a href="#typedef-shape-box">#typedef-shape-box</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-typedef-shape-box">5. Shapes from Box Values</a> <a href="#ref-for-typedef-shape-box①">(2)</a> <li><a href="#ref-for-typedef-shape-box②">6.1. Float Area Shape: the shape-outside property</a> <a href="#ref-for-typedef-shape-box③">(2)</a> <a href="#ref-for-typedef-shape-box④">(3)</a> <a href="#ref-for-typedef-shape-box⑤">(4)</a> <a href="#ref-for-typedef-shape-box⑥">(5)</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-shape-box-margin-box"> <b><a href="#valdef-shape-box-margin-box">#valdef-shape-box-margin-box</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-shape-box-margin-box">1.4. Terminology</a> <li><a href="#ref-for-valdef-shape-box-margin-box①">5. Shapes from Box Values</a> <a href="#ref-for-valdef-shape-box-margin-box②">(2)</a> <a href="#ref-for-valdef-shape-box-margin-box③">(3)</a> <li><a href="#ref-for-valdef-shape-box-margin-box④">6.1. Float Area Shape: the shape-outside property</a> <a href="#ref-for-valdef-shape-box-margin-box⑤">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-shape-box-border-box"> <b><a href="#valdef-shape-box-border-box">#valdef-shape-box-border-box</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-shape-box-border-box">5. Shapes from Box Values</a> <li><a href="#ref-for-valdef-shape-box-border-box①">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-shape-box-padding-box"> <b><a href="#valdef-shape-box-padding-box">#valdef-shape-box-padding-box</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-shape-box-padding-box">5. Shapes from Box Values</a> <li><a href="#ref-for-valdef-shape-box-padding-box①">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-shape-box-content-box"> <b><a href="#valdef-shape-box-content-box">#valdef-shape-box-content-box</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-shape-box-content-box">5. Shapes from Box Values</a> <li><a href="#ref-for-valdef-shape-box-content-box①">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="propdef-shape-outside"> <b><a href="#propdef-shape-outside">#propdef-shape-outside</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-shape-outside">1. Introduction</a> <a href="#ref-for-propdef-shape-outside①">(2)</a> <li><a href="#ref-for-propdef-shape-outside②">1.4. Terminology</a> <li><a href="#ref-for-propdef-shape-outside③">2. Relation to the box model and float behavior</a> <a href="#ref-for-propdef-shape-outside④">(2)</a> <a href="#ref-for-propdef-shape-outside⑤">(3)</a> <li><a href="#ref-for-propdef-shape-outside⑥">3.1. Supported Shapes</a> <li><a href="#ref-for-propdef-shape-outside⑦">4. Shapes from Image</a> <a href="#ref-for-propdef-shape-outside⑧">(2)</a> <li><a href="#ref-for-propdef-shape-outside⑨">6. Declaring Shapes</a> <a href="#ref-for-propdef-shape-outside①⓪">(2)</a> <li><a href="#ref-for-propdef-shape-outside①①">6.1. Float Area Shape: the shape-outside property</a> <a href="#ref-for-propdef-shape-outside①②">(2)</a> <li><a href="#ref-for-propdef-shape-outside①③">6.3. Expanding a Shape: the shape-margin property</a> <a href="#ref-for-propdef-shape-outside①④">(2)</a> <li><a href="#ref-for-propdef-shape-outside①⑤">8. Security Considerations</a> </ul> </aside> <aside class="dfn-panel" data-for="valdef-shape-outside-none"> <b><a href="#valdef-shape-outside-none">#valdef-shape-outside-none</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-valdef-shape-outside-none">6.1. Float Area Shape: the shape-outside property</a> </ul> </aside> <aside class="dfn-panel" data-for="propdef-shape-image-threshold"> <b><a href="#propdef-shape-image-threshold">#propdef-shape-image-threshold</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-shape-image-threshold">4. Shapes from Image</a> <a href="#ref-for-propdef-shape-image-threshold①">(2)</a> <a href="#ref-for-propdef-shape-image-threshold②">(3)</a> <li><a href="#ref-for-propdef-shape-image-threshold③">6.1. Float Area Shape: the shape-outside property</a> <li><a href="#ref-for-propdef-shape-image-threshold④">6.2. Choosing Image Pixels: the shape-image-threshold property</a> <a href="#ref-for-propdef-shape-image-threshold⑤">(2)</a> </ul> </aside> <aside class="dfn-panel" data-for="propdef-shape-margin"> <b><a href="#propdef-shape-margin">#propdef-shape-margin</a></b><b>Referenced in:</b> <ul> <li><a href="#ref-for-propdef-shape-margin">4. Shapes from Image</a> <li><a href="#ref-for-propdef-shape-margin①">6. Declaring Shapes</a> <a href="#ref-for-propdef-shape-margin②">(2)</a> <li><a href="#ref-for-propdef-shape-margin③">6.3. Expanding a Shape: the shape-margin property</a> <a href="#ref-for-propdef-shape-margin④">(2)</a> <a href="#ref-for-propdef-shape-margin⑤">(3)</a> <a href="#ref-for-propdef-shape-margin⑥">(4)</a> <a href="#ref-for-propdef-shape-margin⑦">(5)</a> <a href="#ref-for-propdef-shape-margin⑧">(6)</a> </ul> </aside> <script>/* script-dfn-panel */ document.body.addEventListener("click", function(e) { var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); } // Find the dfn element or panel, if any, that was clicked on. var el = e.target; var target; var hitALink = false; while(el.parentElement) { if(el.tagName == "A") { // Clicking on a link in a <dfn> shouldn't summon the panel hitALink = true; } if(el.classList.contains("dfn-paneled")) { target = "dfn"; break; } if(el.classList.contains("dfn-panel")) { target = "dfn-panel"; break; } el = el.parentElement; } if(target != "dfn-panel") { // Turn off any currently "on" or "activated" panels. queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){ el.classList.remove("on"); el.classList.remove("activated"); }); } if(target == "dfn" && !hitALink) { // open the panel var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']"); if(dfnPanel) { dfnPanel.classList.add("on"); var rect = el.getBoundingClientRect(); dfnPanel.style.left = window.scrollX + rect.right + 5 + "px"; dfnPanel.style.top = window.scrollY + rect.top + "px"; var panelRect = dfnPanel.getBoundingClientRect(); var panelWidth = panelRect.right - panelRect.left; if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) { // Reposition, because the panel is overflowing dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px"; } } else { console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']"); } } else if(target == "dfn-panel") { // Switch it to "activated" state, which pins it. el.classList.add("activated"); el.style.left = null; el.style.top = null; } }); </script>