<pre class='metadata'>
Title: CSS Exclusions Module Level 1
Status: ED
Work Status: Exploring
Shortname: css-exclusions
Level: 1
Group: csswg
ED: https://drafts.csswg.org/css-exclusions/
TR: https://www.w3.org/TR/css3-exclusions/
Previous Version: https://www.w3.org/TR/2015/WD-css3-exclusions-20150115/
Previous Version: https://www.w3.org/TR/2013/WD-css3-exclusions-20130528/
Editor: Rossen Atanassov, Microsoft, ratan@microsoft.com, w3cid 49885
Editor: Vincent Hardy, Adobe, vhardy@adobe.com
Editor: Alan Stearns, Adobe, astearns@adobe.com, w3cid 46659
!Issues list: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;product=CSS&amp;component=Exclusions&amp;resolution=---&amp;cmdtype=doit">in Bugzilla</a>
!Test Suite: <a href="http://test.csswg.org/suites/css3-exclusions/nightly-unstable/">http://test.csswg.org/suites/css3-exclusions/nightly-unstable/</a>
Abstract: CSS Exclusions define arbitrary areas around which inline content ([[!CSS21]]) can flow. CSS Exclusions can be defined on any CSS block-level elements. CSS Exclusions extend the notion of content wrapping previously limited to floats.
Ignored Terms: div, dl, dfn
</pre>
<pre class=link-defaults>
spec:css-position-3; type:value; text:fixed
</pre>

<style type="text/css">
  .singleImgExample {
    display: block;
    margin: auto;
  }

  .example-table {
    table-layout: fixed;
    width: 100%;
  }

  .example-table tr td img {
    width: 90%;
  }
</style>

<h2 id="intro">
Introduction</h2>

  <em>This section is not normative.</em>

  This specification defines features that allow inline flow
  content to wrap around outside the <span>exclusion area</span> of elements.

<h2 id="terms">
Terminology</h2>

  <dl export>
    <dt><dfn>Exclusion box</dfn>
    <dd>
      A <a href="https://www.w3.org/TR/css3-box/">box</a> ([[!CSS3BOX]]) that defines
      an <span>exclusion area</span> for other boxes. The 'wrap-flow' property is
      used to make an element's generated box an exclusion box. An exclusion box
      contributes its <span>exclusion area</span> to its <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a>
      <span>wrapping context</span>. An element with a ''float'' computed value other
      than ''float/none'' does not become an exclusion.

    <dt><dfn>Exclusion area</dfn>
    <dd>
      The area used for excluding inline flow content around an exclusion box. The
      <span>exclusion area</span> is equivalent to the
      <a>border box</a>
      for an exclusion box.

      <p class="note">
        If a user agent implements both CSS Exclusions and CSS Shapes, the
        shape-outside property defines the exclusion area instead of the border box.

    <dt><dfn>Exclusion element</dfn>
    <dd>
      An <span>exclusion element</span> is a block-level element which is not a float
      and generates an <span>exclusion box</span>. An element generates an exclusion
      box when its ''wrap-flow'' property's computed value is not ''auto''.

    <dt><dfn>Wrapping context</dfn>
    <dd>
      The <span>wrapping context</span> of a box is a collection of <span>exclusion
      areas</span> contributed by its associated <span>exclusion boxes</span>.
      During layout, a box wraps its inline flow content in the <code>wrapping area</code>
      that corresponds to the subtraction of its <span>wrapping context</span> from
      its own <span>content area</span>.

      A box inherits its <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a> <span>wrapping context</span> unless it specifically
      resets it using the 'wrap-through' property.

    <dt><dfn>Content area</dfn>
    <dd>
      The <a>content area</a> is normally used for layout of the inline flow content of a box.

    <dt><dfn>Wrapping area</dfn>
    <dd>
      The area used for layout of inline flow content of a box affected by a
      <span>wrapping context</span>, defined by subtracting the <span>wrapping
      context</span> from its <span>content area</span>.

    <dt><dfn>Outside</dfn> and <dfn>inside</dfn>
    <dd>
      In this specification, <a>outside</a> refers to DOM content that is not a descendant
      of an element while <a>inside</a> refers to the element's descendants.
  </dl>

<h2 id="exclusions">
Exclusions</h2>

  Exclusion elements define <span>exclusion areas</span> that contribute to their
  containing block's <span>wrapping context</span>. As a consequence, exclusions
  impact the layout of their containing block's descendants.

  Elements lay out their inline content in their <span>content area</span> and wrap
  around the <span>exclusion areas</span> in their associated <span>wrapping
  context</span>. If the element is itself an exclusion, it does not wrap around
  its own exclusion area and the impact of other exclusions on other exclusions
  is controlled by the 'z-index' property as explained in the
  'exclusions order' section.

<h3 id="declaring-exclusions">
Declaring exclusions</h3>

  An element becomes an exclusion when its 'wrap-flow' property has a computed
  value other than ''auto''.

<h4 id="wrap-flow-property">
The 'wrap-flow' property</h4>

  <pre class="propdef">
  Name: wrap-flow
  Value: auto | both | start | end | minimum | maximum | clear
  Initial: auto
  Applies to: block-level elements.
  Inherited: no
  Percentages: N/A
  Computed value: as specified except for element's whose 'float' computed value is not ''float/none'', in which case the computed value is ''auto''.
  </pre>

  The values of this property have the following meanings:

  <dl dfn-for="wrap-flow" dfn-type=value>
    <dt><dfn>auto</dfn>
    <dd>
        No exclusion is created. Inline flow content interacts with the element
        as usual. In particular, if the element is a
        <a href="https://www.w3.org/TR/CSS2/visuren.html#floats">float</a>
        (see [[!CSS21]]), the behavior is unchanged.

    <dt><dfn>both</dfn>
    <dd>
        Inline flow content can flow on all sides of the exclusion.

    <dt><dfn>start</dfn>
    <dd>
        Inline flow content can flow around the start edge of the <span>exclusion
        area</span> but must leave the area next to the end edge of the exclusion
        empty.

    <dt><dfn>end</dfn>
    <dd>
        Inline flow content can flow around the end edge of the
        <span>exclusion area</span> but must leave the area next to the start edge
        of the exclusion empty.

    <dt><dfn>minimum</dfn>
    <dd>
        Inline flow content can flow around the edge of the exclusion with the
        smallest available space within the flow content's containing block, and
        must leave the other edge of the exclusion empty.

    <dt><dfn>maximum</dfn>
    <dd>
        Inline flow content can flow around the edge of the exclusion with the
        largest available space within the flow content's containing block, and
        must leave the other edge of the exclusion empty.

    <dt><dfn>clear</dfn>
    <dd>
        Inline flow content can only flow before and after the exclusion in the
        flow content's block direction and must leave the areas next to the start
        and end edges of the exclusion empty.
  </dl>

  If the property's computed value is ''auto'', the element does not become an
  <span>exclusion</span>.

  Otherwise, a computed 'wrap-flow' property value of ''both'', ''start'', ''end'',
  ''minimum'', ''maximum'' or ''clear'' on an  element makes that element an
  <a>exclusion element</a>. It's <a>exclusion area</a> is contributed
  to its containing block's <a>wrapping context</a>, causing the containing
  block's descendants to wrap around its <a>exclusion area</a>.

  <div class="figure">
    <img alt="LTR text wrapping on left edge, RTL text wrapping on right edge, and vertical text wrapping on top edge." src="images/exclusion-writing-modes.png" width="70%" />
    <p class="caption">Exclusion with 'wrap-flow': ''start'' interacting with various
    writing modes.</p>
  </div>

  Determining the relevant edges of the exclusion depends on the
  <a href="https://www.w3.org/TR/css3-writing-modes/#text-flow">writing mode</a> [[!CSS3-WRITING-MODES]] of the content wrapping around the 'exclusion area'.

  An <a>exclusion element</a> establishes a new <a href="">block formatting
  context</a> (see [[!CSS21]]) for its content.

  <div class="figure">
      <img alt="General illustration showing how exclusions combine" src="images/exclusions-illustration.png" width="70%" />
      <p class="caption">Combining exclusions</p>
  </div>

  The above figure illustrates how exclusions are combined. The outermost box
  represents an element's content box. The A, B, C and D darker gray boxes
  represent exclusions in the element's <a>wrapping context</a>.
  A, B, C and D have their respective 'wrap-flow' computed to ''both'', ''start'',
  ''end'' and ''clear'' respectively. The lighter gray areas show the additional areas
  that are excluded for inline layout as a result of the 'wrap-flow'value.
  For example, the area to the right of B cannot be used for inline layout
  of left-to-right writing mode content because the 'wrap-flow' for B is ''start''.

  The background blue area shows what areas are available for a left-to-right
  writing mode element's inline content layout.
  All areas represented with a light or dark shade of gray are not available for
  (left-to-right writing mode) inline content layout.

<div class="example">
  The 'wrap-flow' property values applied to exclusions as grid items.

<pre>
&lt;div id="grid"&gt;
    &lt;div id="top-right" class="exclusion"&gt;&lt;/div&gt;
    &lt;div id="bottom-left" class="exclusion"&gt;&lt;/div&gt;
    &lt;div id="content"&gt;Lorem ipsum…&lt;/div&gt;
&lt;/div&gt;

&lt;style type="text/css"&gt;
#grid {
    width: 30em;
    height: 30em;
    display: grid;
    grid-columns: 25% 25% 25% 25%;
    grid-rows: 25% 25% 25% 25%;

#top-right {
    grid-column: 3;
    grid-row: 2;
}

#bottom-left {
    grid-column: 2;
    grid-row: 3;
}

.exclusion {
    wrap-flow: &lt;see below&gt;
}

#content {
    grid-row: 1;
    grid-row-span: 4;
    grid-column: 1;
    grid-column-span: 4;
}
&lt;/style&gt;
</pre>

  The following figures illustrate the visual rendering for different values
  of the 'wrap-flow' property. The gray grid lines are marking the grid cells
  and the blue area is the exclusion box (positioned by the grid).

  <table class="example-table">
      <tr>
          <td><code class="html">.exclusion{ wrap-flow: auto; }</code></td>
          <td><code class="html">.exclusion{ wrap-flow: both; }</code></td>
      </tr>
      <tr>
          <td><img src="images/exclusion_wrap_side_auto.png" alt="Example rendering for wrap-side: auto" /></td>
          <td><img src="images/exclusion_wrap_side_both.png" alt="Example rendering for wrap-side: both" /></td>
      </tr>
      <tr>
          <td><code class="html">.exclusion{ wrap-flow: start; }</code></td>
          <td><code class="html">.exclusion{ wrap-flow: end; }</code></td>
      </tr>
      <tr>
          <td><img src="images/exclusion_wrap_side_left.png" alt="Example rendering for wrap-side: start" /></td>
          <td><img src="images/exclusion_wrap_side_right.png" alt="Example rendering for wrap-side: end" /></td>
      </tr>
      <tr>
          <td><code class="html">.exclusion{ wrap-flow: minimum; }</code></td>
          <td><code class="html">.exclusion{ wrap-flow: maximum; }</code></td>
      </tr>
      <tr>
          <td><img src="images/exclusion_wrap_side_minimum.png" alt="Example rendering for wrap-side: minimum" /></td>
          <td><img src="images/exclusion_wrap_side_maximum.png" alt="Example rendering for wrap-side: maximum" /></td>
      </tr>
      <tr>
          <td><code class="html">.exclusion{ wrap-flow: clear; }</code></td>
          <td></td>
      </tr>
      <tr>
          <td><img src="images/exclusion_wrap_side_clear.png" alt="Example rendering for wrap-side: clear" /></td>
          <td></td>
      </tr>
  </table>
</div>

<!-- End section "wrap-flow Property" -->
<!-- End section "Declaring Exclusions" -->

<h3 id="scope-and-effect-of-exclusions">
Scope and effect of exclusions</h3>

  An <span>exclusion</span> affects the inline flow content descended from the
  exclusion's containing block (defined in <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">CSS 2.1 10.1</a>) and that of all descendant
  elements of the same containing block. All inline flow content inside the
  containing block of the exclusions is affected. To stop the effect of exclusions
  defined outside an element, the 'wrap-through' property can be used
  (see the <a href="#propagation-of-exclusions">propagation of exclusions</a>
  section below).

  As a reminder, for exclusions with 'position':''fixed'', the containing block
  is established by the root element.

<!-- End section "Scope and Effect of Exclusions" -->

<h3 id="propagation-of-exclusions">
Propagation of Exclusions</h3>

  By default, an element inherits its parent <a>wrapping context</a>. In other
  words it is subject to the exclusions defined <a>outside</a>
  the element.

  Setting the 'wrap-through' property to ''wrap-through/none'' prevents an
  element from inheriting its parent <a>wrapping context</a>. In other words,
  exclusions defined ''outside'' the element, have not effect on the element's
  children layout.

  <p class="note">
    Exclusions defined by an element's descendants still contribute to their
    containing block's <a>wrapping context</a>. If that containing block is a
    child of an element with 'wrap-through' computes to ''wrap-through/none'',
    or the element itself, then exclusion still have an effect on the children
    of that containing block element.
  </p>

<h4 id="wrap-through-property">
The 'wrap-through' Property</h4>

<pre class="propdef">
Name: wrap-through
Value: wrap | none
Initial: wrap
Applies to: block-level elements
Inherited: no
Percentages: N/A
Computed value: as specified
</pre>

The values of this property have the following meanings:

<dl dfn-for="wrap-through" dfn-type=value>
  <dt><dfn>wrap</dfn></dt>
  <dd>
    The element inherits its parent node's <a>wrapping context</a>. Its descendant
    inline content wraps around exclusions defined <a>outside</a>
    the element.

  <dt><dfn>none</dfn></dt>
  <dd>
    The element does not inherit its parent node's <a>wrapping context</a>. Its
    descendants are only subject to exclusion areas defined <a>inside</a>
    the element.
</dl>

<div class="example">
  Using the 'wrap-through' property to control the effect of exclusions.

<pre><code class="html">

&lt;style type="text/css"&gt;
    #grid {
        display: grid;
        grid-columns: 25% 50% 25%;
        grid-rows: 25% 25% 25% 25%;
    }

    #exclusion {
        grid-row: 2;
        grid-row-span: 2;
        grid-column: 2;
        wrap-flow: &lt;see below&gt;
    }

    #rowA, #rowB {
        grid-row-span: 2;
        grid-column: 1;
        grid-column-span: 3;
    }

    #rowA {
        grid-row: 1;
    }

    #rowB {
        grid-row: 3;
    }
    &lt;/style&gt;

&lt;style type="text/css"&gt;
    .exclusion  {
      wrap-flow: both;
      position: absolute;
      left: 20%;
      top: 20%;
      width: 50%;
      height: 50%;
      background-color: rgba(220, 230, 242, 0.5);
    }
&lt;/style&gt;

&lt;div id="grid"&gt;
    &lt;div class=”exclusion”&gt;&lt;/div&gt;
    &lt;div id="rowA" style=”wrap-through: wrap;”&gt; Lorem ipsum dolor sit amet...&lt;/div&gt;
    &lt;div id="rowB" style=”wrap-through: none;”&gt; Lorem ipsum dolor sit amet...&lt;/div&gt;
&lt;/div&gt;
</code></pre>

  <img class="singleImgExample" src="images/exclusion_wrap_through.png" alt="Example rendering of wrap-through: wrap | none" style="max-width:40%"/>
</div>

<!-- End section "wrap-through property" -->
<!-- End section "Propagation of Exclusions" -->

<h3 id="exclusions-order">
Exclusions order</h3>

  Exclusions follow the painting order (See [[!CSS21]] Appendix E). Exclusions are
  applied in reverse to the document order in which they are defined. The last exclusion
  appears on top of all other exclusion, thus it affects the inline flow content of
  all other preceding exclusions or elements descendant of the same containing block.
  The 'z-index' property can be used to change the ordering of
  <a href="https://www.w3.org/TR/CSS2/visuren.html#choose-position">positioned</a> exclusion
  boxes (see [[!CSS21]]). Statically positioned exclusions are not affected by the
  'z-index' property and thus follow the painting order.

<div class="example">

  Ordering of exclusions.

<pre><code class="html">
&lt;style type="text/css"&gt;
    .exclusion  {
      wrap-flow: both;
      position: absolute;
      width: 200px;
    }
    .topleft {
      top: 10px;
      left: 10px;
      background-color: lightblue;
    }
    .middle {
      top: 90px;
      left: 90px;
      background-color: lightgreen;
    }
    .bottomright {
      top: 170px;
      left: 170px;
      background-color: pink;
    }
&lt;/style&gt;

&lt;div class="exclusion topleft"&gt;
    The top left div...
&lt;/div&gt;
&lt;div class="exclusion middle"&gt;
    The middle div...
&lt;/div&gt;
&lt;div class="exclusion bottomright"&gt;
    The bottom right div...
&lt;/div&gt;
</code></pre>

<table class="example-table">
  <tr>
    <td style="width:50%"><code class="html">.middle { z-index: auto; }</code></td>
    <td style="width:50%"><code class="html">.middle { z-index: 1; }</code></td>
  </tr>
  <tr>
    <td><img class="singleImgExample" src="images/exclusion_ordering.png" alt="Example rendering of default exclusion ordering." /></td>
    <td><img class="singleImgExample" src="images/exclusion_ordering_z_order.png" alt="Example rendering of default exclusion ordering." /></td>
  </tr>
</table>
</div>

<!-- End section "Order of Exclusions" -->

<div class="issue-marker wrapper">
  <div class="issue-marker">
    <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15183">Issue-15183</a>
    <div class="issue-details">
      <p class="short-desc">Is the CSS exclusions processing model incorrect?</p>
    </div>
  </div>
</div>

<div class="issue">

  The current draft provides a model for exclusions
  without a collision-avoidance model.
  The existing exclusion model in CSS uses floats,
  which have both exclusion and collision-avoidance behavior.
  Concerns have been raised that allowing exclusions
  without collision avoidance could be harmful,
  particularly with absolutely-positioned elements.
  Three options should be considered:

  <ol>
  <li>Allow exclusions in positioning schemes
      with no collision avoidance.</li>
  <li>Disallow exclusions in positioning schemes
      with no collision avoidance.</li>
  <li>Define collision-avoidance behavior
      for positioning schemes without it,
      and use this behavior by default with exclusions.</li>
  </ol>
</div>

<h3 id="exclusions-processing-model">
Processing model</h3>

<h4 id="exclusions-processing-model-description">
Description</h4>

  Applying exclusions is a two-step process:

<ul>
  <li><strong>Step 1</strong>: resolve exclusion boxes belonging to each
  <a>wrapping context</a>
  <li><strong>Step 2</strong>: resolve each <a>wrapping context</a> and lay out
  each containing block in turn:
  <ul>
    <li><strong>Step 2-A</strong>: resolve the position and size of exclusion
    boxes
    <li><strong>Step 2-B</strong>: lay out containing block, wrapping around
    each <a>exclusion area</a>
  </ul>
</ul>

<h4 id="step-1">
Step 1: resolve exclusion boxes belonging to each <a>wrapping context</a></h4>

  In this step, the user agent determines which <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block</a> each <a>exclusion area</a>
  belongs to. This is a simple step, based on the definition of containing
  blocks and elements with a computed value for 'wrap-flow' that is not
  <code class="css">auto</code>.

<h4 id="step-2">
Step 2: resolve wrapping contexts and lay out containing blocks</h4>

  In this step, starting from the top of the <a href="https://www.w3.org/TR/CSS2/visuren.html#z-index">rendering tree</a> (see [[!CSS21]]), the the agent processes each
  containing block in two sub-steps.

<h4 id="step-2-A">
Step 2-A: resolve the position and size of exclusion boxes</h4>

  Resolving the position and size of <a>exclusion boxes</a> in the <a>wrapping
  context</a> may or may not require a layout. For example, if an <a>exclusion
  box</a> is absolutely positioned and sized, a layout may not be needed to
  resolve its position and size. In other situations, laying out the containing
  block's content is required.

  When a layout is required, it is carried out without applying any <a>exclusion
  area</a>. In other words, the containing block is laid out without a
  <a>wrapping context</a>.

  Step 2-A yields a position and size for all <a>exclusion boxes</a> in the
  <a>wrapping context</a>. Each exclusion box is processed in turn, starting from
  the top-most, and each <a>exclusion area</a> is computed and contributed to the
  <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing
  block's</a> <a>wrapping context</a>.

  Scrolling is ignored in this step when resolving the position and size of
  'position': ''fixed'' <a>exclusion boxes</a>.

  Once the <a href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a> <a>wrapping context</a> is computed, all <a>exclusion boxes</a> in
  that <a>wrapping context</a> are removed from the normal flow.

<h4 id="step-2-B">
Step 2-B: lay out containing block applying wrapping</h4>

Finally, the content of the containing block is laid out, with the inline content
wrapping around the <a>wrapping context</a>'s <a>exclusion area</a>.


  When the containing block itself is an <a>exclusion box</a>, then rules on
  <a href="#exclusions-order">exclusions order</a> define which exclusions affect
  the inline and descendant content of the box.

<h4 id="processing-model-example">
Processing Model Example</h4>

  This section illustrates the exclusions processing model with an example.
  It is meant to be simple. Yet, it contains enough complexity to address the
  issues of layout dependencies and re-layout.


  The code snippet in the following example has two exclusions affecting the
  document's inline content.

<div class="example">
<pre class="html">&lt;html&gt;
&lt;style&gt;
#d1 {
    position:relative;
    height: auto;
    color: #46A4E9;
    border: 1px solid gray;
}

#e1 {
    wrap-flow: both;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 40%;
    height: 40%;
    border: 1px solid red;
    margin-left: -20%;
    margin-top: -20%;
}

#d2 {
    position: static;
    width: 100%;
    height: auto;
    color: #808080;
}

#e2 {
    wrap-flow: both;
    position: absolute;
    right: 5ex;
    top: 1em;
    width: 12ex;
    height: 10em;
    border: 1px solid lime;
}
&lt;/style&gt;
&lt;body&gt;
    &lt;div id="d1"&gt;
        Lorem ipsusm ...
        &lt;p id="e1"&gt;&lt;/p&gt;
    &lt;/div&gt;
    &lt;div id="d2"&gt;
        Lorem ipsusm ...
        &lt;p id="e2" &gt;&lt;/p&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
</div>

  The following figures illustrate:
  <ul>
    <li>the document's DOM tree
    <li>the layout tree of generated block boxes
  </ul>

  <div class="figure">
    <img src="images/processing-model-example-dom.svg" width="200" alt="DOM tree nodes"/>
    <p class="caption">DOM tree
  </div>

  <div class="figure">
    <img src="images/processing-model-example-layout-tree.svg" width="350" alt="Layout tree boxes"/>
    <p class="caption">Layout tree of generated block boxes
  </div>

<h5 id="example-step-1">
Step 1: resolve exclusion boxes belonging to each <a>wrapping context</a></h5>

  The figures illustrate how the boxes corresponding to the element sometimes
  have a different containment hierarchy in the layout tree than in the DOM tree.
  For example, the box generated by <code class="idl">e1</code> is positioned in
  its containing block's box, which is the <code class="idl">d1-box</code>, because
  <code class="idl">e1</code> is absolutely positioned and <code class="idl">d1</code>
  is relatively positioned. However, while <code class="idl">e2</code> is also absolutely
  positioned, its containing block is the initial containing block (ICB). See the
  section 10.1 of the CSS 2.1 specification ([[!CSS21]]) for details.

  As a result of the computation of containing blocks for the tree, the boxes
  belonging to the <a>wrapping context</a>s of all the elements can be determined:

  <ul>
    <li>The <a>wrapping context</a> for the html element contains the
    <code class="idl">e2</code> box: WC-1 (Wrapping Context 1)

    <li>The <a>wrapping context</a> for the body element inherits the html
    element's <a>wrapping context</a>: WC-1

    <li>The <a>wrapping context</a> for <code class="idl">d1</code> inherits the
    body element's <a>wrapping context</a> and adds the <code class="idl">e1-box</code>
    to it. So the wrapping context is made of both the
    <code class="idl">e1-box</code> and the <code class="idl">e2-box</code>:
    WC-2</li>

    <li>The <a>wrapping context</a> for <code class="idl">d2</code> inherits the
    body element's <a>wrapping context</a>: WC-1
  </ul>

<h5 id="example-step-2">
Step 2: resolve wrapping contexts and lay out containing blocks</h5>

  In this step, each containing block is processed in turn. For each containing
  block, we (conceptually) go through two phases:

<ol>
  <li>resolve the <a>wrapping context</a>: resolve the position and size of its
  exclusions

  <li>lay out the containing block
</ol>

  In our example, this breaks down to:

  <ol>
    <li>resolve the position and size of the exclusions belonging to WC-1:
    RWC-1 (Resolved Wrapping Context 1).

    <li>lay out the initial containing block (i.e., lay out its content):
    <ol>
      <li>resolve the html element's <a>wrapping context</a>: RWC-1
      <li>lay out the html element:
        <ol>
          <li>resolve the body element's <a>wrapping context</a>: RWC-1
          <li>lay out the body element:
            <ol>
              <li>resolve the <code class="idl">d1</code> element's <a>wrapping
              context</a>: RWC-2

              <li>lay out the <code class="idl">d1</code> element

              <li>resolve the <code class="idl">d2</code> element's <a>wrapping
              context</a>: RWC-1

              <li>lay out the <code class="idl">d2</code> element
            </ol>
          </li>
        </ol>
      </li>
    </ol>
  </li>
</ol>

<h6 id="example-resolving-rwc-1">
Resolving RWC-1</h6>

  The top-most <a>wrapping context</a> in the layout tree contains the
  <code class="idl">e2</code> exclusion. Its position and size needs to be
  resolved. In general, computing an exclusion's position and size may or may
  not require laying out other content. In this example, no content needs to be
  laid out to resolve the <code class="idl">e2</code> exclusion's position
  because it is absolutely positioned and its size can be resolved without
  layout either. At this point, RWC-1 is resolved and can be used when laying
  inline content out.</p>

<h6 id="example-resolving-rwc-2">
Resolving RWC-2</h6>

  The process is similar: the position of the <code class="idl">e1</code>
  exclusion needs to be resolved. Again, resolving the exclusion's position and
  size may require processing the containing block (d1 here). It is the case here
  because the size and position of <code class="idl">e1</code> depend on
  resolving the percentage lengths. The percentages are relative to the size of
  <code class="idl">d1</code>'s box. As a result, in order to resolve a size for
  <code class="idl">d1</code>'s box, a first layout of <code class="idl">d1</code>
  is done without any <a>wrapping context</a> (i.e., no exclusions applied).
  The layout yields a position and size for <code class="idl">e1</code>'s box.

  At this point, RWC-2 is resolved because the position and size of both e1 and
  e2 are resolved.

  <p class="note">The important aspect of the above processing example is that
  once an element's <a>wrapping context</a> is resolved (by resolving its
  exclusions' position and size), the position and size of the exclusions are
  not re-processed if the element's size changes between the layout that may be
  done without considering any <a>wrapping context</a> (as for RWC-2) and the
  layout done with the resolved <a>wrapping context</a>. This is what breaks the
  possible circular dependency between the resolution of <a>wrapping context</a>s
  and the layout of containing blocks.</p>

<h3 id="floats-and-exclusions">
Floats and exclusions</h3>

<h4 id="floats-and-exclusions-similarities">
Similarities</h4>

  There are similarities between floats and exclusions in that inline content
  wraps around floats and also wraps around <span>exclusion areas</span>. However,
  there are very significant differences.

<h4 id="floats-and-exclusions-differences">
Differences</h4>

  <ul>
    <li><strong>scope</strong>. While floats apply to content that follows in the
    document, exclusions apply to content in their containing block.

    <li><strong>positioning</strong>. Floats are part of the inline flow and
    'float' on the line box. Authors can control how the floats move on the line
    box, to the right or to the left. By contrast, exclusions can be positioned
    using any positioning scheme such as grid layout ([[CSS3-GRID-LAYOUT]]),
    flexible box ([[CSS3-FLEXBOX]]) or any other CSS positioning scheme.

    <li><strong>separation of concerns</strong>. Making an element a float
    determines both its positioning scheme and its effect on inline content.
    Making an element an exclusion only determines its impact on inline content
    and does not impose constraints on its positioning method.
  </ul>

<h4 id="floats-interop">
Interoperability</h4>

<h5 id="effect-of-floats-on-exclusions">
Effect of floats on exclusions</h5>

  Floats have an effect on the positioning of exclusions and the layout of their
  inline content. For example, if an exclusion is an inline-box which happens to
  be on the same line as a float, its position, as computed in
  <a href="#step-2-A">Step 2-A</a> will be impacted by the float, as is any other
  inline content.

<h5 id="effect-of-exclusions-on-floats">
Effect of exclusions on floats</h5>

  Exclusions have an effect on the positioning of floats as they have an effect
  on inline content. Therefore, in <a href="#step-2-B">Step 2-B</a>, floats will
  avoid <a>exclusion areas</a>.

<h2 class="no-num" id="acks">
Acknowledgments</h2>

  This specification is made possible by input from
  Andrei Bucur,
  Alexandru Chiculita,
  Arron Eicholz,
  Daniel Glazman,
  Arno Gourdol,
  Chris Jones,
  Bem Jones-Bey,
  Marcus Mielke,
  Alex Mogilevsky,
  Hans Muller,
  Mihnea Ovidenie,
  Virgil Palanciuc,
  Florian Rivoal,
  Peter Sorotokin,
  Bear Travis,
  Eugene Veselov,
  Stephen Zilles
  and the CSS Working Group members.

<h2 class="no-num" id="changes">Changes</h2>

  <h3 class="no-num" id="recent-changes">
  Changes from the <a href="https://www.w3.org/TR/2015/WD-css3-exclusions-20150115/">15 January 2015 Working Draft</a></h3>

  <h3 class="no-num" id="changes-2013">
  Changes from the <a href="https://www.w3.org/TR/2013/WD-css3-exclusions-20130528/">28 May 2013 Working Draft</a></h3>

  <ul>
    <li>Editorial fixes.
  </ul>

  <h3 class="no-num" id="changes-2012">
  Changes from the <a href="https://www.w3.org/TR/2012/WD-css3-exclusions-20120503/">3 May 2012 Working Draft</a></h3>

  <ul>
    <li>Split Exclusions from Shapes.
    <li>Improved exclusion order example.
    <li>Editorial and markup fixes.
    <li>See also the Changes section of <a href="https://www.w3.org/TR/css-shapes/#20120503">CSS Shapes</a>.
  </ul>