Sun, 31 Jan 2016 15:42:31 -0800
change //dev.w3.org/csswg/ urls to //drafts.csswg.org/
Rossen@14695 | 1 | <h1>CSS Exclusions Module Level 1</h1> |
Rossen@14695 | 2 | |
Rossen@14695 | 3 | <pre class='metadata'> |
Rossen@14695 | 4 | Status: ED |
jackalmage@15674 | 5 | Work Status: Exploring |
Rossen@14695 | 6 | Shortname: css-exclusions |
Rossen@14695 | 7 | Level: 1 |
Rossen@14695 | 8 | Group: csswg |
peter@16986 | 9 | ED: https://drafts.csswg.org/css-exclusions/ |
Rossen@14695 | 10 | TR: http://www.w3.org/TR/css3-exclusions/ |
dbaron@16542 | 11 | Previous Version: http://www.w3.org/TR/2015/WD-css3-exclusions-20150115/ |
Rossen@14695 | 12 | Previous Version: http://www.w3.org/TR/2013/WD-css3-exclusions-20130528/ |
Rossen@14695 | 13 | Editor: Rossen Atanassov, Microsoft, [email protected] |
Rossen@14695 | 14 | Editor: Vincent Hardy, Adobe, [email protected] |
Rossen@14695 | 15 | Editor: Alan Stearns, Adobe, [email protected] |
Rossen@14695 | 16 | !Issues list: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&product=CSS&component=Exclusions&resolution=---&cmdtype=doit">in Bugzilla</a> |
Rossen@14695 | 17 | !Test Suite: <a href="http://test.csswg.org/suites/css3-exclusions/nightly-unstable/">http://test.csswg.org/suites/css3-exclusions/nightly-unstable/</a> |
Rossen@14695 | 18 | 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. |
Rossen@14695 | 19 | Ignored Terms: div, dl, dfn |
Rossen@14695 | 20 | </pre> |
Rossen@14695 | 21 | |
Rossen@14695 | 22 | <style type="text/css"> |
Rossen@14695 | 23 | .singleImgExample { |
Rossen@14695 | 24 | display: block; |
Rossen@14695 | 25 | margin: auto; |
Rossen@14695 | 26 | } |
Rossen@14695 | 27 | |
Rossen@14695 | 28 | .example-table { |
Rossen@14695 | 29 | table-layout: fixed; |
Rossen@14695 | 30 | width: 100%; |
Rossen@14695 | 31 | } |
Rossen@14695 | 32 | |
Rossen@14695 | 33 | .example-table tr td img { |
Rossen@14695 | 34 | width: 90%; |
Rossen@14695 | 35 | } |
Rossen@14695 | 36 | </style> |
Rossen@14695 | 37 | |
Rossen@14695 | 38 | <h2 id="intro"> |
Rossen@14695 | 39 | Introduction</h2> |
Rossen@14695 | 40 | |
Rossen@14695 | 41 | <em>This section is not normative.</em> |
Rossen@14695 | 42 | |
Rossen@14695 | 43 | This specification defines features that allow inline flow |
Rossen@14695 | 44 | content to wrap around outside the <span>exclusion area</span> of elements. |
Rossen@14695 | 45 | |
Rossen@14695 | 46 | <h2 id="terms"> |
Rossen@14695 | 47 | Terminology</h2> |
Rossen@14695 | 48 | |
Rossen@14695 | 49 | <dl export> |
jackalmage@15132 | 50 | <dt><dfn>Exclusion box</dfn> |
Rossen@14695 | 51 | <dd> |
Rossen@14695 | 52 | A <a href="http://www.w3.org/TR/css3-box/">box</a> ([[!CSS3BOX]]) that defines |
Rossen@14695 | 53 | an <span>exclusion area</span> for other boxes. The 'wrap-flow' property is |
Rossen@14695 | 54 | used to make an element's generated box an exclusion box. An exclusion box |
Rossen@14695 | 55 | contributes its <span>exclusion area</span> to its <a href="http://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a> |
Rossen@14695 | 56 | <span>wrapping context</span>. An element with a ''float'' computed value other |
Rossen@14695 | 57 | than ''none'' does not become an exclusion. |
Rossen@14695 | 58 | |
jackalmage@15132 | 59 | <dt><dfn>Exclusion area</dfn> |
Rossen@14695 | 60 | <dd> |
Rossen@14695 | 61 | The area used for excluding inline flow content around an exclusion box. The |
Rossen@14695 | 62 | <span>exclusion area</span> is equivalent to the |
Rossen@14695 | 63 | <a href="http://www.w3.org/TR/CSS2/box.html#box-dimensions">border box</a> |
Rossen@14695 | 64 | for an exclusion box. |
Rossen@14695 | 65 | |
Rossen@14695 | 66 | <p class="note"> |
Rossen@14695 | 67 | If a user agent implements both CSS Exclusions and CSS Shapes, the |
Rossen@14695 | 68 | shape-outside property defines the exclusion area instead of the border box. |
Rossen@14695 | 69 | |
jackalmage@15132 | 70 | <dt><dfn>Exclusion element</dfn> |
Rossen@14695 | 71 | <dd> |
Rossen@14695 | 72 | An <span>exclusion element</span> is a block-level element which is not a float |
Rossen@14695 | 73 | and generates an <span>exclusion box</span>. An element generates an exclusion |
Rossen@14695 | 74 | box when its ''wrap-flow'' property's computed value is not ''auto''. |
Rossen@14695 | 75 | |
jackalmage@15132 | 76 | <dt><dfn>Wrapping context</dfn> |
Rossen@14695 | 77 | <dd> |
Rossen@14695 | 78 | The <span>wrapping context</span> of a box is a collection of <span>exclusion |
Rossen@14695 | 79 | areas</span> contributed by its associated <span>exclusion boxes</span>. |
Rossen@14695 | 80 | During layout, a box wraps its inline flow content in the <code>wrapping area</code> |
Rossen@14695 | 81 | that corresponds to the subtraction of its <span>wrapping context</span> from |
Rossen@14695 | 82 | its own <span>content area</span>. |
Rossen@14695 | 83 | |
Rossen@14695 | 84 | A box inherits its <a href="http://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block's</a> <span>wrapping context</span> unless it specifically |
Rossen@14695 | 85 | resets it using the 'wrap-through' property. |
Rossen@14695 | 86 | |
jackalmage@15132 | 87 | <dt><dfn>Content area</dfn> |
Rossen@14695 | 88 | <dd> |
Rossen@14695 | 89 | The <a href="http://www.w3.org/TR/CSS2/box.html#box-dimensions">content area</a> |
Rossen@14695 | 90 | is normally used for layout of the inline flow content of a box. |
Rossen@14695 | 91 | |
jackalmage@15132 | 92 | <dt><dfn>Wrapping area</dfn> |
Rossen@14695 | 93 | <dd> |
Rossen@14695 | 94 | The area used for layout of inline flow content of a box affected by a |
Rossen@14695 | 95 | <span>wrapping context</span>, defined by subtracting the <span>wrapping |
Rossen@14695 | 96 | context</span> from its <span>content area</span>. |
Rossen@14695 | 97 | |
jackalmage@15132 | 98 | <dt><dfn>Outside</dfn> and <dfn>inside</dfn> |
Rossen@14695 | 99 | <dd> |
jackalmage@15132 | 100 | In this specification, <a>outside</a> refers to DOM content that is not a descendant |
jackalmage@15132 | 101 | of an element while <a>inside</a> refers to the element's descendants. |
Rossen@14695 | 102 | </dl> |
Rossen@14695 | 103 | |
Rossen@14695 | 104 | <h2 id="exclusions"> |
Rossen@14695 | 105 | Exclusions</h2> |
Rossen@14695 | 106 | |
Rossen@14695 | 107 | Exclusion elements define <span>exclusion areas</span> that contribute to their |
Rossen@14695 | 108 | containing block's <span>wrapping context</span>. As a consequence, exclusions |
Rossen@14695 | 109 | impact the layout of their containing block's descendants. |
Rossen@14695 | 110 | |
stearns@14712 | 111 | Elements lay out their inline content in their <span>content area</span> and wrap |
Rossen@14695 | 112 | around the <span>exclusion areas</span> in their associated <span>wrapping |
Rossen@14695 | 113 | context</span>. If the element is itself an exclusion, it does not wrap around |
Rossen@14695 | 114 | its own exclusion area and the impact of other exclusions on other exclusions |
Rossen@14695 | 115 | is controlled by the 'z-index' property as explained in the |
Rossen@14695 | 116 | 'exclusions order' section. |
Rossen@14695 | 117 | |
Rossen@14695 | 118 | <h3 id="declaring-exclusions"> |
Rossen@14695 | 119 | Declaring exclusions</h3> |
Rossen@14695 | 120 | |
Rossen@14695 | 121 | An element becomes an exclusion when its 'wrap-flow' property has a computed |
Rossen@14695 | 122 | value other than ''auto''. |
Rossen@14695 | 123 | |
Rossen@14695 | 124 | <h4 id="wrap-flow-property"> |
Rossen@14695 | 125 | The 'wrap-flow' property</h4> |
Rossen@14695 | 126 | |
Rossen@14695 | 127 | <pre class="propdef"> |
Rossen@14695 | 128 | Name: wrap-flow |
Rossen@14695 | 129 | Value: auto | both | start | end | minimum | maximum | clear |
Rossen@14695 | 130 | Initial: auto |
Rossen@14695 | 131 | Applies to: block-level elements. |
Rossen@14695 | 132 | Inherited: no |
Rossen@14695 | 133 | Percentages: N/A |
Rossen@14695 | 134 | Media: visual |
Rossen@14695 | 135 | Computed value: as specified except for element's whose 'float' computed value is not ''none'', in which case the computed value is ''auto''. |
Rossen@14695 | 136 | </pre> |
Rossen@14695 | 137 | |
Rossen@14695 | 138 | The values of this property have the following meanings: |
Rossen@14695 | 139 | |
Rossen@14695 | 140 | <dl dfn-for="wrap-flow" dfn-type=value> |
jackalmage@15132 | 141 | <dt><dfn>auto</dfn> |
Rossen@14695 | 142 | <dd> |
Rossen@14695 | 143 | No exclusion is created. Inline flow content interacts with the element |
Rossen@14695 | 144 | as usual. In particular, if the element is a |
Rossen@14695 | 145 | <a href="http://www.w3.org/TR/CSS2/visuren.html#floats">float</a> |
Rossen@14695 | 146 | (see [[!CSS21]]), the behavior is unchanged. |
Rossen@14695 | 147 | |
jackalmage@15132 | 148 | <dt><dfn>both</dfn> |
Rossen@14695 | 149 | <dd> |
Rossen@14695 | 150 | Inline flow content can flow on all sides of the exclusion. |
Rossen@14695 | 151 | |
jackalmage@15132 | 152 | <dt><dfn>start</dfn> |
Rossen@14695 | 153 | <dd> |
Rossen@14695 | 154 | Inline flow content can flow around the start edge of the <span>exclusion |
Rossen@14695 | 155 | area</span> but must leave the area next to the end edge of the exclusion |
Rossen@14695 | 156 | empty. |
Rossen@14695 | 157 | |
jackalmage@15132 | 158 | <dt><dfn>end</dfn> |
Rossen@14695 | 159 | <dd> |
Rossen@14695 | 160 | Inline flow content can flow around the end edge of the |
Rossen@14695 | 161 | <span>exclusion area</span> but must leave the area next to the start edge |
Rossen@14695 | 162 | of the exclusion empty. |
Rossen@14695 | 163 | |
jackalmage@15132 | 164 | <dt><dfn>minimum</dfn> |
Rossen@14695 | 165 | <dd> |
Rossen@14695 | 166 | Inline flow content can flow around the edge of the exclusion with the |
Rossen@14695 | 167 | smallest available space within the flow content's containing block, and |
Rossen@14695 | 168 | must leave the other edge of the exclusion empty. |
Rossen@14695 | 169 | |
jackalmage@15132 | 170 | <dt><dfn>maximum</dfn> |
Rossen@14695 | 171 | <dd> |
Rossen@14695 | 172 | Inline flow content can flow around the edge of the exclusion with the |
Rossen@14695 | 173 | largest available space within the flow content's containing block, and |
Rossen@14695 | 174 | must leave the other edge of the exclusion empty. |
Rossen@14695 | 175 | |
jackalmage@15132 | 176 | <dt><dfn>clear</dfn> |
Rossen@14695 | 177 | <dd> |
Rossen@14695 | 178 | Inline flow content can only flow before and after the exclusion in the |
Rossen@14695 | 179 | flow content's block direction and must leave the areas next to the start |
Rossen@14695 | 180 | and end edges of the exclusion empty. |
Rossen@14695 | 181 | </dl> |
Rossen@14695 | 182 | |
Rossen@14695 | 183 | If the property's computed value is ''auto'', the element does not become an |
Rossen@14695 | 184 | <span>exclusion</span>. |
Rossen@14695 | 185 | |
Rossen@14695 | 186 | Otherwise, a computed 'wrap-flow' property value of ''both'', ''start'', ''end'', |
Rossen@14695 | 187 | ''minimum'', ''maximum'' or ''clear'' on an element makes that element an |
Rossen@14695 | 188 | <a>exclusion element</a>. It's <a>exclusion area</a> is contributed |
Rossen@14695 | 189 | to its containing block's <a>wrapping context</a>, causing the containing |
Rossen@14695 | 190 | block's descendants to wrap around its <a>exclusion area</a>. |
Rossen@14695 | 191 | |
Rossen@14695 | 192 | <div class="figure"> |
Rossen@14695 | 193 | <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%" /> |
Rossen@14695 | 194 | <p class="caption">Exclusion with 'wrap-flow': ''start'' interacting with various |
Rossen@14695 | 195 | writing modes.</p> |
Rossen@14695 | 196 | </div> |
Rossen@14695 | 197 | |
Rossen@14695 | 198 | Determining the relevant edges of the exclusion depends on the |
Rossen@14695 | 199 | <a href="http://www.w3.org/TR/css3-writing-modes/#text-flow">writing mode</a> [[!CSS3-WRITING-MODES]] of the content wrapping around the 'exclusion area'. |
Rossen@14695 | 200 | |
Rossen@14695 | 201 | An <a>exclusion element</a> establishes a new <a href="">block formatting |
Rossen@14695 | 202 | context</a> (see [[!CSS21]]) for its content. |
Rossen@14695 | 203 | |
Rossen@14695 | 204 | <div class="figure"> |
Rossen@14695 | 205 | <img alt="General illustration showing how exclusions combine" src="images/exclusions-illustration.png" width="70%" /> |
Rossen@14695 | 206 | <p class="caption">Combining exclusions</p> |
Rossen@14695 | 207 | </div> |
Rossen@14695 | 208 | |
Rossen@14695 | 209 | The above figure illustrates how exclusions are combined. The outermost box |
Rossen@14695 | 210 | represents an element's content box. The A, B, C and D darker gray boxes |
Rossen@14695 | 211 | represent exclusions in the element's <a>wrapping context</a>. |
Rossen@14695 | 212 | A, B, C and D have their respective 'wrap-flow' computed to ''both'', ''start'', |
Rossen@14695 | 213 | ''end'' and ''clear'' respectively. The lighter gray areas show the additional areas |
Rossen@14695 | 214 | that are excluded for inline layout as a result of the 'wrap-flow'value. |
Rossen@14695 | 215 | For example, the area to the right of B cannot be used for inline layout |
Rossen@14695 | 216 | of left-to-right writing mode content because the 'wrap-flow' for B is ''start''. |
Rossen@14695 | 217 | |
Rossen@14695 | 218 | The background blue area shows what areas are available for a left-to-right |
Rossen@14695 | 219 | writing mode element's inline content layout. |
Rossen@14695 | 220 | All areas represented with a light or dark shade of gray are not available for |
Rossen@14695 | 221 | (left-to-right writing mode) inline content layout. |
Rossen@14695 | 222 | |
Rossen@14695 | 223 | <div class="example"> |
Rossen@14695 | 224 | The 'wrap-flow' property values applied to exclusions as grid items. |
Rossen@14695 | 225 | |
Rossen@14695 | 226 | <pre> |
Rossen@14695 | 227 | <div id="grid"> |
Rossen@14695 | 228 | <div id="top-right" class="exclusion"></div> |
Rossen@14695 | 229 | <div id="bottom-left" class="exclusion"></div> |
Rossen@14695 | 230 | <div id="content">Lorem ipsumâ¦</div> |
Rossen@14695 | 231 | </div> |
Rossen@14695 | 232 | |
Rossen@14695 | 233 | <style type="text/css"> |
Rossen@14695 | 234 | #grid { |
Rossen@14695 | 235 | width: 30em; |
Rossen@14695 | 236 | height: 30em; |
Rossen@14695 | 237 | display: grid; |
Rossen@14695 | 238 | grid-columns: 25% 25% 25% 25%; |
Rossen@14695 | 239 | grid-rows: 25% 25% 25% 25%; |
Rossen@14695 | 240 | |
Rossen@14695 | 241 | #top-right { |
Rossen@14695 | 242 | grid-column: 3; |
Rossen@14695 | 243 | grid-row: 2; |
Rossen@14695 | 244 | } |
Rossen@14695 | 245 | |
Rossen@14695 | 246 | #bottom-left { |
Rossen@14695 | 247 | grid-column: 2; |
Rossen@14695 | 248 | grid-row: 3; |
Rossen@14695 | 249 | } |
Rossen@14695 | 250 | |
Rossen@14695 | 251 | .exclusion { |
Rossen@14695 | 252 | wrap-flow: <see below> |
Rossen@14695 | 253 | } |
Rossen@14695 | 254 | |
Rossen@14695 | 255 | #content { |
Rossen@14695 | 256 | grid-row: 1; |
Rossen@14695 | 257 | grid-row-span: 4; |
Rossen@14695 | 258 | grid-column: 1; |
Rossen@14695 | 259 | grid-column-span: 4; |
Rossen@14695 | 260 | } |
Rossen@14695 | 261 | </style> |
Rossen@14695 | 262 | </pre> |
Rossen@14695 | 263 | |
Rossen@14695 | 264 | The following figures illustrate the visual rendering for different values |
Rossen@14695 | 265 | of the 'wrap-flow' property. The gray grid lines are marking the grid cells |
Rossen@14695 | 266 | and the blue area is the exclusion box (positioned by the grid). |
Rossen@14695 | 267 | |
Rossen@14695 | 268 | <table class="example-table"> |
Rossen@14695 | 269 | <tr> |
Rossen@14695 | 270 | <td><code class="html">.exclusion{ wrap-flow: auto; }</code></td> |
Rossen@14695 | 271 | <td><code class="html">.exclusion{ wrap-flow: both; }</code></td> |
Rossen@14695 | 272 | </tr> |
Rossen@14695 | 273 | <tr> |
Rossen@14695 | 274 | <td><img src="images/exclusion_wrap_side_auto.png" alt="Example rendering for wrap-side: auto" /></td> |
Rossen@14695 | 275 | <td><img src="images/exclusion_wrap_side_both.png" alt="Example rendering for wrap-side: both" /></td> |
Rossen@14695 | 276 | </tr> |
Rossen@14695 | 277 | <tr> |
Rossen@14695 | 278 | <td><code class="html">.exclusion{ wrap-flow: start; }</code></td> |
Rossen@14695 | 279 | <td><code class="html">.exclusion{ wrap-flow: end; }</code></td> |
Rossen@14695 | 280 | </tr> |
Rossen@14695 | 281 | <tr> |
Rossen@14695 | 282 | <td><img src="images/exclusion_wrap_side_left.png" alt="Example rendering for wrap-side: start" /></td> |
Rossen@14695 | 283 | <td><img src="images/exclusion_wrap_side_right.png" alt="Example rendering for wrap-side: end" /></td> |
Rossen@14695 | 284 | </tr> |
Rossen@14695 | 285 | <tr> |
Rossen@14695 | 286 | <td><code class="html">.exclusion{ wrap-flow: minimum; }</code></td> |
Rossen@14695 | 287 | <td><code class="html">.exclusion{ wrap-flow: maximum; }</code></td> |
Rossen@14695 | 288 | </tr> |
Rossen@14695 | 289 | <tr> |
Rossen@14695 | 290 | <td><img src="images/exclusion_wrap_side_minimum.png" alt="Example rendering for wrap-side: minimum" /></td> |
Rossen@14695 | 291 | <td><img src="images/exclusion_wrap_side_maximum.png" alt="Example rendering for wrap-side: maximum" /></td> |
Rossen@14695 | 292 | </tr> |
Rossen@14695 | 293 | <tr> |
Rossen@14695 | 294 | <td><code class="html">.exclusion{ wrap-flow: clear; }</code></td> |
Rossen@14695 | 295 | <td></td> |
Rossen@14695 | 296 | </tr> |
Rossen@14695 | 297 | <tr> |
Rossen@14695 | 298 | <td><img src="images/exclusion_wrap_side_clear.png" alt="Example rendering for wrap-side: clear" /></td> |
Rossen@14695 | 299 | <td></td> |
Rossen@14695 | 300 | </tr> |
Rossen@14695 | 301 | </table> |
Rossen@14695 | 302 | </div> |
Rossen@14695 | 303 | |
Rossen@14695 | 304 | <!-- End section "wrap-flow Property" --> |
Rossen@14695 | 305 | <!-- End section "Declaring Exclusions" --> |
Rossen@14695 | 306 | |
Rossen@14695 | 307 | <h3 id="scope-and-effect-of-exclusions"> |
Rossen@14695 | 308 | Scope and effect of exclusions</h3> |
Rossen@14695 | 309 | |
Rossen@14695 | 310 | An <span>exclusion</span> affects the inline flow content descended from the |
Rossen@14695 | 311 | exclusion's containing block (defined in <a href="http://www.w3.org/TR/CSS2/visudet.html#containing-block-details">CSS 2.1 10.1</a>) and that of all descendant |
Rossen@14695 | 312 | elements of the same containing block. All inline flow content inside the |
Rossen@14695 | 313 | containing block of the exclusions is affected. To stop the effect of exclusions |
Rossen@14695 | 314 | defined outside an element, the 'wrap-through' property can be used |
Rossen@14695 | 315 | (see the <a href="#propagation-of-exclusions">propagation of exclusions</a> |
Rossen@14695 | 316 | section below). |
Rossen@14695 | 317 | |
Rossen@14695 | 318 | As a reminder, for exclusions with 'position':''fixed'', the containing block |
Rossen@14695 | 319 | is established by the root element. |
Rossen@14695 | 320 | |
Rossen@14695 | 321 | <!-- End section "Scope and Effect of Exclusions" --> |
Rossen@14695 | 322 | |
Rossen@14695 | 323 | <h3 id="propagation-of-exclusions"> |
Rossen@14695 | 324 | Propagation of Exclusions</h3> |
Rossen@14695 | 325 | |
Rossen@14695 | 326 | By default, an element inherits its parent <a>wrapping context</a>. In other |
jackalmage@15132 | 327 | words it is subject to the exclusions defined <a>outside</a> |
Rossen@14695 | 328 | the element. |
Rossen@14695 | 329 | |
Rossen@14695 | 330 | Setting the 'wrap-through' property to ''none'' prevents an element from |
Rossen@14695 | 331 | inheriting its parent <a>wrapping context</a>. In other words, exclusions |
Rossen@14695 | 332 | defined ''outside'' the element, have not effect on the element's children layout. |
Rossen@14695 | 333 | |
Rossen@14695 | 334 | <p class="note"> |
Rossen@14695 | 335 | Exclusions defined by an element's descendants still contribute to their |
Rossen@14695 | 336 | containing block's <a>wrapping context</a>. If that containing block is a |
Rossen@14695 | 337 | child of an element with 'wrap-through' computes to ''none'', or the element |
Rossen@14695 | 338 | itself, then exclusion still have an effect on the children of that |
Rossen@14695 | 339 | containing block element. |
Rossen@14695 | 340 | </p> |
Rossen@14695 | 341 | |
Rossen@14695 | 342 | <h4 id="wrap-through-property"> |
Rossen@14695 | 343 | The 'wrap-through' Property</h4> |
Rossen@14695 | 344 | |
Rossen@14695 | 345 | <pre class="propdef"> |
Rossen@14695 | 346 | Name: wrap-through |
Rossen@14695 | 347 | Value: wrap | none |
Rossen@14695 | 348 | Initial: wrap |
Rossen@14695 | 349 | Applies to: block-level elements |
Rossen@14695 | 350 | Inherited: no |
Rossen@14695 | 351 | Percentages: N/A |
Rossen@14695 | 352 | Media: visual |
Rossen@14695 | 353 | Computed value: as specified |
Rossen@14695 | 354 | </pre> |
Rossen@14695 | 355 | |
Rossen@14695 | 356 | The values of this property have the following meanings: |
Rossen@14695 | 357 | |
Rossen@14695 | 358 | <dl dfn-for="wrap-through" dfn-type=value> |
jackalmage@15132 | 359 | <dt><dfn>wrap</dfn></dt> |
Rossen@14695 | 360 | <dd> |
Rossen@14695 | 361 | The element inherits its parent node's <a>wrapping context</a>. Its descendant |
jackalmage@15132 | 362 | inline content wraps around exclusions defined <a>outside</a> |
Rossen@14695 | 363 | the element. |
Rossen@14695 | 364 | |
jackalmage@15132 | 365 | <dt><dfn>none</dfn></dt> |
Rossen@14695 | 366 | <dd> |
Rossen@14695 | 367 | The element does not inherit its parent node's <a>wrapping context</a>. Its |
jackalmage@15132 | 368 | descendants are only subject to exclusion areas defined <a>inside</a> |
Rossen@14695 | 369 | the element. |
Rossen@14695 | 370 | </dl> |
Rossen@14695 | 371 | |
Rossen@14695 | 372 | <div class="example"> |
Rossen@14695 | 373 | Using the 'wrap-through' property to control the effect of exclusions. |
Rossen@14695 | 374 | |
Rossen@14695 | 375 | <pre><code class="html"> |
Rossen@14695 | 376 | |
Rossen@14695 | 377 | <style type="text/css"> |
Rossen@14695 | 378 | #grid { |
Rossen@14695 | 379 | display: grid; |
Rossen@14695 | 380 | grid-columns: 25% 50% 25%; |
Rossen@14695 | 381 | grid-rows: 25% 25% 25% 25%; |
Rossen@14695 | 382 | } |
Rossen@14695 | 383 | |
Rossen@14695 | 384 | #exclusion { |
Rossen@14695 | 385 | grid-row: 2; |
Rossen@14695 | 386 | grid-row-span: 2; |
Rossen@14695 | 387 | grid-column: 2; |
Rossen@14695 | 388 | wrap-flow: <see below> |
Rossen@14695 | 389 | } |
Rossen@14695 | 390 | |
Rossen@14695 | 391 | #rowA, #rowB { |
Rossen@14695 | 392 | grid-row-span: 2; |
Rossen@14695 | 393 | grid-column: 1; |
Rossen@14695 | 394 | grid-column-span: 3; |
Rossen@14695 | 395 | } |
Rossen@14695 | 396 | |
Rossen@14695 | 397 | #rowA { |
Rossen@14695 | 398 | grid-row: 1; |
Rossen@14695 | 399 | } |
Rossen@14695 | 400 | |
Rossen@14695 | 401 | #rowB { |
Rossen@14695 | 402 | grid-row: 3; |
Rossen@14695 | 403 | } |
Rossen@14695 | 404 | </style> |
Rossen@14695 | 405 | |
Rossen@14695 | 406 | <style type="text/css"> |
Rossen@14695 | 407 | .exclusion { |
Rossen@14695 | 408 | wrap-flow: both; |
Rossen@14695 | 409 | position: absolute; |
Rossen@14695 | 410 | left: 20%; |
Rossen@14695 | 411 | top: 20%; |
Rossen@14695 | 412 | width: 50%; |
Rossen@14695 | 413 | height: 50%; |
Rossen@14695 | 414 | background-color: rgba(220, 230, 242, 0.5); |
Rossen@14695 | 415 | } |
Rossen@14695 | 416 | </style> |
Rossen@14695 | 417 | |
Rossen@14695 | 418 | <div id="grid"> |
Rossen@14695 | 419 | <div class=âexclusionâ></div> |
Rossen@14695 | 420 | <div id="rowA" style=âwrap-through: wrap;â> Lorem ipsum dolor sit amet...</div> |
Rossen@14695 | 421 | <div id="rowB" style=âwrap-through: none;â> Lorem ipsum dolor sit amet...</div> |
Rossen@14695 | 422 | </div> |
Rossen@14695 | 423 | </code></pre> |
Rossen@14695 | 424 | |
Rossen@14695 | 425 | <img class="singleImgExample" src="images/exclusion_wrap_through.png" alt="Example rendering of wrap-through: wrap | none" style="max-width:40%"/> |
Rossen@14695 | 426 | </div> |
Rossen@14695 | 427 | |
Rossen@14695 | 428 | <!-- End section "wrap-through property" --> |
Rossen@14695 | 429 | <!-- End section "Propagation of Exclusions" --> |
Rossen@14695 | 430 | |
Rossen@14695 | 431 | <h3 id="exclusions-order"> |
Rossen@14695 | 432 | Exclusions order</h3> |
Rossen@14695 | 433 | |
Rossen@14695 | 434 | Exclusions follow the painting order (See [[!CSS21]] Appendix E). Exclusions are |
Rossen@14695 | 435 | applied in reverse to the document order in which they are defined. The last exclusion |
Rossen@14695 | 436 | appears on top of all other exclusion, thus it affects the inline flow content of |
Rossen@14695 | 437 | all other preceding exclusions or elements descendant of the same containing block. |
Rossen@14695 | 438 | The 'z-index' property can be used to change the ordering of |
Rossen@14695 | 439 | <a href="http://www.w3.org/TR/CSS2/visuren.html#choose-position">positioned</a> exclusion |
Rossen@14695 | 440 | boxes (see [[!CSS21]]). Statically positioned exclusions are not affected by the |
Rossen@14695 | 441 | 'z-index' property and thus follow the painting order. |
Rossen@14695 | 442 | |
Rossen@14695 | 443 | <div class="example"> |
Rossen@14695 | 444 | |
Rossen@14695 | 445 | Ordering of exclusions. |
Rossen@14695 | 446 | |
Rossen@14695 | 447 | <pre><code class="html"> |
Rossen@14695 | 448 | <style type="text/css"> |
Rossen@14695 | 449 | .exclusion { |
Rossen@14695 | 450 | wrap-flow: both; |
Rossen@14695 | 451 | position: absolute; |
Rossen@14695 | 452 | width: 200px; |
Rossen@14695 | 453 | } |
Rossen@14695 | 454 | .topleft { |
Rossen@14695 | 455 | top: 10px; |
Rossen@14695 | 456 | left: 10px; |
Rossen@14695 | 457 | background-color: lightblue; |
Rossen@14695 | 458 | } |
Rossen@14695 | 459 | .middle { |
Rossen@14695 | 460 | top: 90px; |
Rossen@14695 | 461 | left: 90px; |
Rossen@14695 | 462 | background-color: lightgreen; |
Rossen@14695 | 463 | } |
Rossen@14695 | 464 | .bottomright { |
Rossen@14695 | 465 | top: 170px; |
Rossen@14695 | 466 | left: 170px; |
Rossen@14695 | 467 | background-color: pink; |
Rossen@14695 | 468 | } |
Rossen@14695 | 469 | </style> |
Rossen@14695 | 470 | |
Rossen@14695 | 471 | <div class="exclusion topleft"> |
Rossen@14695 | 472 | The top left div... |
Rossen@14695 | 473 | </div> |
Rossen@14695 | 474 | <div class="exclusion middle"> |
Rossen@14695 | 475 | The middle div... |
Rossen@14695 | 476 | </div> |
Rossen@14695 | 477 | <div class="exclusion bottomright"> |
Rossen@14695 | 478 | The bottom right div... |
Rossen@14695 | 479 | </div> |
Rossen@14695 | 480 | </code></pre> |
Rossen@14695 | 481 | |
Rossen@14695 | 482 | <table class="example-table"> |
Rossen@14695 | 483 | <tr> |
Rossen@14695 | 484 | <td style="width:50%"><code class="html">.middle { z-index: auto; }</code></td> |
Rossen@14695 | 485 | <td style="width:50%"><code class="html">.middle { z-index: 1; }</code></td> |
Rossen@14695 | 486 | </tr> |
Rossen@14695 | 487 | <tr> |
Rossen@14695 | 488 | <td><img class="singleImgExample" src="images/exclusion_ordering.png" alt="Example rendering of default exclusion ordering." /></td> |
Rossen@14695 | 489 | <td><img class="singleImgExample" src="images/exclusion_ordering_z_order.png" alt="Example rendering of default exclusion ordering." /></td> |
Rossen@14695 | 490 | </tr> |
Rossen@14695 | 491 | </table> |
Rossen@14695 | 492 | </div> |
Rossen@14695 | 493 | |
Rossen@14695 | 494 | <!-- End section "Order of Exclusions" --> |
Rossen@14695 | 495 | |
Rossen@14695 | 496 | <div class="issue-marker wrapper"> |
Rossen@14695 | 497 | <div class="issue-marker"> |
Rossen@14695 | 498 | <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15183">Issue-15183</a> |
Rossen@14695 | 499 | <div class="issue-details"> |
Rossen@14695 | 500 | <p class="short-desc">Is the CSS exclusions processing model incorrect?</p> |
Rossen@14695 | 501 | </div> |
Rossen@14695 | 502 | </div> |
Rossen@14695 | 503 | </div> |
Rossen@14695 | 504 | |
Rossen@14695 | 505 | <div class="issue"> |
Rossen@14695 | 506 | |
Rossen@14695 | 507 | The current draft provides a model for exclusions |
Rossen@14695 | 508 | without a collision-avoidance model. |
Rossen@14695 | 509 | The existing exclusion model in CSS uses floats, |
Rossen@14695 | 510 | which have both exclusion and collision-avoidance behavior. |
Rossen@14695 | 511 | Concerns have been raised that allowing exclusions |
Rossen@14695 | 512 | without collision avoidance could be harmful, |
Rossen@14695 | 513 | particularly with absolutely-positioned elements. |
Rossen@14695 | 514 | Three options should be considered: |
Rossen@14695 | 515 | |
Rossen@14695 | 516 | <ol> |
Rossen@14695 | 517 | <li>Allow exclusions in positioning schemes |
Rossen@14695 | 518 | with no collision avoidance.</li> |
Rossen@14695 | 519 | <li>Disallow exclusions in positioning schemes |
Rossen@14695 | 520 | with no collision avoidance.</li> |
Rossen@14695 | 521 | <li>Define collision-avoidance behavior |
Rossen@14695 | 522 | for positioning schemes without it, |
Rossen@14695 | 523 | and use this behavior by default with exclusions.</li> |
Rossen@14695 | 524 | </ol> |
Rossen@14695 | 525 | </div> |
Rossen@14695 | 526 | |
Rossen@14695 | 527 | <h3 id="exclusions-processing-model"> |
Rossen@14695 | 528 | Processing model</h3> |
Rossen@14695 | 529 | |
Rossen@14695 | 530 | <h4 id="exclusions-processing-model-description"> |
Rossen@14695 | 531 | Description</h4> |
Rossen@14695 | 532 | |
Rossen@14695 | 533 | Applying exclusions is a two-step process: |
Rossen@14695 | 534 | |
Rossen@14695 | 535 | <ul> |
Rossen@14695 | 536 | <li><strong>Step 1</strong>: resolve exclusion boxes belonging to each |
Rossen@14695 | 537 | <a>wrapping context</a> |
stearns@14712 | 538 | <li><strong>Step 2</strong>: resolve each <a>wrapping context</a> and lay out |
Rossen@14695 | 539 | each containing block in turn: |
Rossen@14695 | 540 | <ul> |
Rossen@14695 | 541 | <li><strong>Step 2-A</strong>: resolve the position and size of exclusion |
Rossen@14695 | 542 | boxes |
Rossen@14695 | 543 | <li><strong>Step 2-B</strong>: lay out containing block, wrapping around |
Rossen@14695 | 544 | each <a>exclusion area</a> |
Rossen@14695 | 545 | </ul> |
Rossen@14695 | 546 | </ul> |
Rossen@14695 | 547 | |
Rossen@14695 | 548 | <h4 id="step-1"> |
Rossen@14695 | 549 | Step 1: resolve exclusion boxes belonging to each <a>wrapping context</a></h4> |
Rossen@14695 | 550 | |
Rossen@14695 | 551 | In this step, the user agent determines which <a href="http://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block</a> each <a>exclusion area</a> |
Rossen@14695 | 552 | belongs to. This is a simple step, based on the definition of containing |
Rossen@14695 | 553 | blocks and elements with a computed value for 'wrap-flow' that is not |
Rossen@14695 | 554 | <code class="css">auto</code>. |
Rossen@14695 | 555 | |
Rossen@14695 | 556 | <h4 id="step-2"> |
Rossen@14695 | 557 | Step 2: resolve wrapping contexts and lay out containing blocks</h4> |
Rossen@14695 | 558 | |
Rossen@14695 | 559 | In this step, starting from the top of the <a href="http://www.w3.org/TR/CSS2/visuren.html#z-index">rendering tree</a> (see [[!CSS21]]), the the agent processes each |
Rossen@14695 | 560 | containing block in two sub-steps. |
Rossen@14695 | 561 | |
Rossen@14695 | 562 | <h4 id="step-2-A"> |
Rossen@14695 | 563 | Step 2-A: resolve the position and size of exclusion boxes</h4> |
Rossen@14695 | 564 | |
Rossen@14695 | 565 | Resolving the position and size of <a>exclusion boxes</a> in the <a>wrapping |
Rossen@14695 | 566 | context</a> may or may not require a layout. For example, if an <a>exclusion |
Rossen@14695 | 567 | box</a> is absolutely positioned and sized, a layout may not be needed to |
Rossen@14695 | 568 | resolve its position and size. In other situations, laying out the containing |
Rossen@14695 | 569 | block's content is required. |
Rossen@14695 | 570 | |
Rossen@14695 | 571 | When a layout is required, it is carried out without applying any <a>exclusion |
Rossen@14695 | 572 | area</a>. In other words, the containing block is laid out without a |
Rossen@14695 | 573 | <a>wrapping context</a>. |
Rossen@14695 | 574 | |
Rossen@14695 | 575 | Step 2-A yields a position and size for all <a>exclusion boxes</a> in the |
Rossen@14695 | 576 | <a>wrapping context</a>. Each exclusion box is processed in turn, starting from |
Rossen@14695 | 577 | the top-most, and each <a>exclusion area</a> is computed and contributed to the |
Rossen@14695 | 578 | <a href="http://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing |
Rossen@14695 | 579 | block's</a> <a>wrapping context</a>. |
Rossen@14695 | 580 | |
Rossen@14695 | 581 | Scrolling is ignored in this step when resolving the position and size of |
Rossen@14695 | 582 | 'position': ''fixed'' <a>exclusion boxes</a>. |
Rossen@14695 | 583 | |
Rossen@14695 | 584 | Once the <a href="http://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 |
Rossen@14695 | 585 | that <a>wrapping context</a> are removed from the normal flow. |
Rossen@14695 | 586 | |
Rossen@14695 | 587 | <h4 id="step-2-B"> |
Rossen@14695 | 588 | Step 2-B: lay out containing block applying wrapping</h4> |
Rossen@14695 | 589 | |
Rossen@14695 | 590 | Finally, the content of the containing block is laid out, with the inline content |
Rossen@14695 | 591 | wrapping around the <a>wrapping context</a>'s <a>exclusion area</a>. |
Rossen@14695 | 592 | |
Rossen@14695 | 593 | |
Rossen@14695 | 594 | When the containing block itself is an <a>exclusion box</a>, then rules on |
Rossen@14695 | 595 | <a href="#exclusions-order">exclusions order</a> define which exclusions affect |
Rossen@14695 | 596 | the inline and descendant content of the box. |
Rossen@14695 | 597 | |
Rossen@14695 | 598 | <h4 id="processing-model-example"> |
Rossen@14695 | 599 | Processing Model Example</h4> |
Rossen@14695 | 600 | |
Rossen@14695 | 601 | This section illustrates the exclusions processing model with an example. |
Rossen@14695 | 602 | It is meant to be simple. Yet, it contains enough complexity to address the |
Rossen@14695 | 603 | issues of layout dependencies and re-layout. |
Rossen@14695 | 604 | |
Rossen@14695 | 605 | |
Rossen@14695 | 606 | The code snippet in the following example has two exclusions affecting the |
Rossen@14695 | 607 | document's inline content. |
Rossen@14695 | 608 | |
Rossen@14695 | 609 | <div class="example"> |
Rossen@14695 | 610 | <pre class="html"><html> |
Rossen@14695 | 611 | <style> |
Rossen@14695 | 612 | #d1 { |
Rossen@14695 | 613 | position:relative; |
Rossen@14695 | 614 | height: auto; |
Rossen@14695 | 615 | color: #46A4E9; |
Rossen@14695 | 616 | border: 1px solid gray; |
Rossen@14695 | 617 | } |
Rossen@14695 | 618 | |
Rossen@14695 | 619 | #e1 { |
Rossen@14695 | 620 | wrap-flow: both; |
Rossen@14695 | 621 | position: absolute; |
Rossen@14695 | 622 | left: 50%; |
Rossen@14695 | 623 | top: 50%; |
Rossen@14695 | 624 | width: 40%; |
Rossen@14695 | 625 | height: 40%; |
Rossen@14695 | 626 | border: 1px solid red; |
Rossen@14695 | 627 | margin-left: -20%; |
Rossen@14695 | 628 | margin-top: -20%; |
Rossen@14695 | 629 | } |
Rossen@14695 | 630 | |
Rossen@14695 | 631 | #d2 { |
Rossen@14695 | 632 | position: static; |
Rossen@14695 | 633 | width: 100%; |
Rossen@14695 | 634 | height: auto; |
Rossen@14695 | 635 | color: #808080; |
Rossen@14695 | 636 | } |
Rossen@14695 | 637 | |
Rossen@14695 | 638 | #e2 { |
Rossen@14695 | 639 | wrap-flow: both; |
Rossen@14695 | 640 | position: absolute; |
Rossen@14695 | 641 | right: 5ex; |
Rossen@14695 | 642 | top: 1em; |
Rossen@14695 | 643 | width: 12ex; |
Rossen@14695 | 644 | height: 10em; |
Rossen@14695 | 645 | border: 1px solid lime; |
Rossen@14695 | 646 | } |
Rossen@14695 | 647 | </style> |
Rossen@14695 | 648 | <body> |
Rossen@14695 | 649 | <div id="d1"> |
Rossen@14695 | 650 | Lorem ipsusm ... |
Rossen@14695 | 651 | <p id="e1"></p> |
Rossen@14695 | 652 | </div> |
Rossen@14695 | 653 | <div id="d2"> |
Rossen@14695 | 654 | Lorem ipsusm ... |
Rossen@14695 | 655 | <p id="e2" ></p> |
Rossen@14695 | 656 | </div> |
Rossen@14695 | 657 | </body> |
Rossen@14695 | 658 | </html></pre> |
Rossen@14695 | 659 | </div> |
Rossen@14695 | 660 | |
Rossen@14695 | 661 | The following figures illustrate: |
Rossen@14695 | 662 | <ul> |
Rossen@14695 | 663 | <li>the document's DOM tree |
Rossen@14695 | 664 | <li>the layout tree of generated block boxes |
Rossen@14695 | 665 | </ul> |
Rossen@14695 | 666 | |
Rossen@14695 | 667 | <div class="figure"> |
Rossen@14695 | 668 | <img src="images/processing-model-example-dom.svg" width="200" alt="DOM tree nodes"/> |
Rossen@14695 | 669 | <p class="caption">DOM tree |
Rossen@14695 | 670 | </div> |
Rossen@14695 | 671 | |
Rossen@14695 | 672 | <div class="figure"> |
Rossen@14695 | 673 | <img src="images/processing-model-example-layout-tree.svg" width="350" alt="Layout tree boxes"/> |
Rossen@14695 | 674 | <p class="caption">Layout tree of generated block boxes |
Rossen@14695 | 675 | </div> |
Rossen@14695 | 676 | |
Rossen@14695 | 677 | <h5 id="example-step-1"> |
Rossen@14695 | 678 | Step 1: resolve exclusion boxes belonging to each <a>wrapping context</a></h5> |
Rossen@14695 | 679 | |
Rossen@14695 | 680 | The figures illustrate how the boxes corresponding to the element sometimes |
Rossen@14695 | 681 | have a different containment hierarchy in the layout tree than in the DOM tree. |
Rossen@14695 | 682 | For example, the box generated by <code class="idl">e1</code> is positioned in |
Rossen@14695 | 683 | its containing block's box, which is the <code class="idl">d1-box</code>, because |
Rossen@14695 | 684 | <code class="idl">e1</code> is absolutely positioned and <code class="idl">d1</code> |
Rossen@14695 | 685 | is relatively positioned. However, while <code class="idl">e2</code> is also absolutely |
Rossen@14695 | 686 | positioned, its containing block is the initial containing block (ICB). See the |
Rossen@14695 | 687 | section 10.1 of the CSS 2.1 specification ([[!CSS21]]) for details. |
Rossen@14695 | 688 | |
Rossen@14695 | 689 | As a result of the computation of containing blocks for the tree, the boxes |
Rossen@14695 | 690 | belonging to the <a>wrapping context</a>s of all the elements can be determined: |
Rossen@14695 | 691 | |
Rossen@14695 | 692 | <ul> |
Rossen@14695 | 693 | <li>The <a>wrapping context</a> for the html element contains the |
Rossen@14695 | 694 | <code class="idl">e2</code> box: WC-1 (Wrapping Context 1) |
Rossen@14695 | 695 | |
Rossen@14695 | 696 | <li>The <a>wrapping context</a> for the body element inherits the html |
Rossen@14695 | 697 | element's <a>wrapping context</a>: WC-1 |
Rossen@14695 | 698 | |
Rossen@14695 | 699 | <li>The <a>wrapping context</a> for <code class="idl">d1</code> inherits the |
Rossen@14695 | 700 | body element's <a>wrapping context</a> and adds the <code class="idl">e1-box</code> |
Rossen@14695 | 701 | to it. So the wrapping context is made of both the |
Rossen@14695 | 702 | <code class="idl">e1-box</code> and the <code class="idl">e2-box</code>: |
Rossen@14695 | 703 | WC-2</li> |
Rossen@14695 | 704 | |
Rossen@14695 | 705 | <li>The <a>wrapping context</a> for <code class="idl">d2</code> inherits the |
Rossen@14695 | 706 | body element's <a>wrapping context</a>: WC-1 |
Rossen@14695 | 707 | </ul> |
Rossen@14695 | 708 | |
Rossen@14695 | 709 | <h5 id="example-step-2"> |
Rossen@14695 | 710 | Step 2: resolve wrapping contexts and lay out containing blocks</h5> |
Rossen@14695 | 711 | |
Rossen@14695 | 712 | In this step, each containing block is processed in turn. For each containing |
Rossen@14695 | 713 | block, we (conceptually) go through two phases: |
Rossen@14695 | 714 | |
Rossen@14695 | 715 | <ol> |
Rossen@14695 | 716 | <li>resolve the <a>wrapping context</a>: resolve the position and size of its |
Rossen@14695 | 717 | exclusions |
Rossen@14695 | 718 | |
Rossen@14695 | 719 | <li>lay out the containing block |
Rossen@14695 | 720 | </ol> |
Rossen@14695 | 721 | |
Rossen@14695 | 722 | In our example, this breaks down to: |
Rossen@14695 | 723 | |
Rossen@14695 | 724 | <ol> |
Rossen@14695 | 725 | <li>resolve the position and size of the exclusions belonging to WC-1: |
Rossen@14695 | 726 | RWC-1 (Resolved Wrapping Context 1). |
Rossen@14695 | 727 | |
Rossen@14695 | 728 | <li>lay out the initial containing block (i.e., lay out its content): |
Rossen@14695 | 729 | <ol> |
Rossen@14695 | 730 | <li>resolve the html element's <a>wrapping context</a>: RWC-1 |
Rossen@14695 | 731 | <li>lay out the html element: |
Rossen@14695 | 732 | <ol> |
Rossen@14695 | 733 | <li>resolve the body element's <a>wrapping context</a>: RWC-1 |
Rossen@14695 | 734 | <li>lay out the body element: |
Rossen@14695 | 735 | <ol> |
Rossen@14695 | 736 | <li>resolve the <code class="idl">d1</code> element's <a>wrapping |
Rossen@14695 | 737 | context</a>: RWC-2 |
Rossen@14695 | 738 | |
Rossen@14695 | 739 | <li>lay out the <code class="idl">d1</code> element |
Rossen@14695 | 740 | |
Rossen@14695 | 741 | <li>resolve the <code class="idl">d2</code> element's <a>wrapping |
Rossen@14695 | 742 | context</a>: RWC-1 |
Rossen@14695 | 743 | |
Rossen@14695 | 744 | <li>lay out the <code class="idl">d2</code> element |
Rossen@14695 | 745 | </ol> |
Rossen@14695 | 746 | </li> |
Rossen@14695 | 747 | </ol> |
Rossen@14695 | 748 | </li> |
Rossen@14695 | 749 | </ol> |
Rossen@14695 | 750 | </li> |
Rossen@14695 | 751 | </ol> |
Rossen@14695 | 752 | |
Rossen@14695 | 753 | <h6 id="example-resolving-rwc-1"> |
Rossen@14695 | 754 | Resolving RWC-1</h6> |
Rossen@14695 | 755 | |
Rossen@14695 | 756 | The top-most <a>wrapping context</a> in the layout tree contains the |
Rossen@14695 | 757 | <code class="idl">e2</code> exclusion. Its position and size needs to be |
Rossen@14695 | 758 | resolved. In general, computing an exclusion's position and size may or may |
Rossen@14695 | 759 | not require laying out other content. In this example, no content needs to be |
Rossen@14695 | 760 | laid out to resolve the <code class="idl">e2</code> exclusion's position |
Rossen@14695 | 761 | because it is absolutely positioned and its size can be resolved without |
Rossen@14695 | 762 | layout either. At this point, RWC-1 is resolved and can be used when laying |
Rossen@14695 | 763 | inline content out.</p> |
Rossen@14695 | 764 | |
Rossen@14695 | 765 | <h6 id="example-resolving-rwc-2"> |
Rossen@14695 | 766 | Resolving RWC-2</h6> |
Rossen@14695 | 767 | |
Rossen@14695 | 768 | The process is similar: the position of the <code class="idl">e1</code> |
Rossen@14695 | 769 | exclusion needs to be resolved. Again, resolving the exclusion's position and |
Rossen@14695 | 770 | size may require processing the containing block (d1 here). It is the case here |
Rossen@14695 | 771 | because the size and position of <code class="idl">e1</code> depend on |
Rossen@14695 | 772 | resolving the percentage lengths. The percentages are relative to the size of |
Rossen@14695 | 773 | <code class="idl">d1</code>'s box. As a result, in order to resolve a size for |
Rossen@14695 | 774 | <code class="idl">d1</code>'s box, a first layout of <code class="idl">d1</code> |
Rossen@14695 | 775 | is done without any <a>wrapping context</a> (i.e., no exclusions applied). |
Rossen@14695 | 776 | The layout yields a position and size for <code class="idl">e1</code>'s box. |
Rossen@14695 | 777 | |
Rossen@14695 | 778 | At this point, RWC-2 is resolved because the position and size of both e1 and |
Rossen@14695 | 779 | e2 are resolved. |
Rossen@14695 | 780 | |
Rossen@14695 | 781 | <p class="note">The important aspect of the above processing example is that |
Rossen@14695 | 782 | once an element's <a>wrapping context</a> is resolved (by resolving its |
Rossen@14695 | 783 | exclusions' position and size), the position and size of the exclusions are |
Rossen@14695 | 784 | not re-processed if the element's size changes between the layout that may be |
Rossen@14695 | 785 | done without considering any <a>wrapping context</a> (as for RWC-2) and the |
Rossen@14695 | 786 | layout done with the resolved <a>wrapping context</a>. This is what breaks the |
Rossen@14695 | 787 | possible circular dependency between the resolution of <a>wrapping context</a>s |
Rossen@14695 | 788 | and the layout of containing blocks.</p> |
Rossen@14695 | 789 | |
Rossen@14695 | 790 | <h3 id="floats-and-exclusions"> |
Rossen@14695 | 791 | Floats and exclusions</h3> |
Rossen@14695 | 792 | |
Rossen@14695 | 793 | <h4 id="floats-and-exclusions-similarities"> |
Rossen@14695 | 794 | Similarities</h4> |
Rossen@14695 | 795 | |
Rossen@14695 | 796 | There are similarities between floats and exclusions in that inline content |
Rossen@14695 | 797 | wraps around floats and also wraps around <span>exclusion areas</span>. However, |
Rossen@14695 | 798 | there are very significant differences. |
Rossen@14695 | 799 | |
Rossen@14695 | 800 | <h4 id="floats-and-exclusions-differences"> |
Rossen@14695 | 801 | Differences</h4> |
Rossen@14695 | 802 | |
Rossen@14695 | 803 | <ul> |
Rossen@14695 | 804 | <li><strong>scope</strong>. While floats apply to content that follows in the |
Rossen@14695 | 805 | document, exclusions apply to content in their containing block. |
Rossen@14695 | 806 | |
Rossen@14695 | 807 | <li><strong>positioning</strong>. Floats are part of the inline flow and |
Rossen@14695 | 808 | 'float' on the line box. Authors can control how the floats move on the line |
Rossen@14695 | 809 | box, to the right or to the left. By contrast, exclusions can be positioned |
Rossen@14695 | 810 | using any positioning scheme such as grid layout ([[CSS3-GRID-LAYOUT]]), |
Rossen@14695 | 811 | flexible box ([[CSS3-FLEXBOX]]) or any other CSS positioning scheme. |
Rossen@14695 | 812 | |
Rossen@14695 | 813 | <li><strong>separation of concerns</strong>. Making an element a float |
Rossen@14695 | 814 | determines both its positioning scheme and its effect on inline content. |
Rossen@14695 | 815 | Making an element an exclusion only determines its impact on inline content |
Rossen@14695 | 816 | and does not impose constraints on its positioning method. |
Rossen@14695 | 817 | </ul> |
Rossen@14695 | 818 | |
Rossen@14695 | 819 | <h4 id="floats-interop"> |
Rossen@14695 | 820 | Interoperability</h4> |
Rossen@14695 | 821 | |
Rossen@14695 | 822 | <h5 id="effect-of-floats-on-exclusions"> |
Rossen@14695 | 823 | Effect of floats on exclusions</h5> |
Rossen@14695 | 824 | |
Rossen@14695 | 825 | Floats have an effect on the positioning of exclusions and the layout of their |
Rossen@14695 | 826 | inline content. For example, if an exclusion is an inline-box which happens to |
Rossen@14695 | 827 | be on the same line as a float, its position, as computed in |
Rossen@14695 | 828 | <a href="#step-2-A">Step 2-A</a> will be impacted by the float, as is any other |
Rossen@14695 | 829 | inline content. |
Rossen@14695 | 830 | |
Rossen@14695 | 831 | <h5 id="effect-of-exclusions-on-floats"> |
Rossen@14695 | 832 | Effect of exclusions on floats</h5> |
Rossen@14695 | 833 | |
Rossen@14695 | 834 | Exclusions have an effect on the positioning of floats as they have an effect |
Rossen@14695 | 835 | on inline content. Therefore, in <a href="#step-2-B">Step 2-B</a>, floats will |
Rossen@14695 | 836 | avoid <a>exclusion areas</a>. |
Rossen@14695 | 837 | |
Rossen@14695 | 838 | <h2 class="no-num" id="acks"> |
Rossen@14695 | 839 | Acknowledgments</h2> |
Rossen@14695 | 840 | |
Rossen@14695 | 841 | This specification is made possible by input from |
Rossen@14695 | 842 | Andrei Bucur, |
Rossen@14695 | 843 | Alexandru Chiculita, |
Rossen@14695 | 844 | Arron Eicholz, |
Rossen@14695 | 845 | Daniel Glazman, |
Rossen@14695 | 846 | Arno Gourdol, |
Rossen@14695 | 847 | Chris Jones, |
Rossen@14695 | 848 | Bem Jones-Bey, |
Rossen@14695 | 849 | Marcus Mielke, |
Rossen@14695 | 850 | Alex Mogilevsky, |
Rossen@14695 | 851 | Hans Muller, |
Rossen@14695 | 852 | Mihnea Ovidenie, |
Rossen@14695 | 853 | Virgil Palanciuc, |
stearns@14749 | 854 | Florian Rivoal, |
Rossen@14695 | 855 | Peter Sorotokin, |
Rossen@14695 | 856 | Bear Travis, |
Rossen@14695 | 857 | Eugene Veselov, |
Rossen@14695 | 858 | Stephen Zilles |
jackalmage@15132 | 859 | and the CSS Working Group members. |