-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathnotes
288 lines (251 loc) · 10 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
the <span>exclusion area</span> for an <span>exclusion element</span>
or
(cut from Shapes section intro)
<span>exclusions</span> and
(cut from Shapes section intro note)
<dfn>Content area</dfn>
<p>
The <a href="http://www.w3.org/TR/CSS2/box.html#box-dimensions">content area</a>
is normally used for layout of the inline flow content of a box.
</p>
<div class="issue-marker" data-bug_id="15089" data-bug_status="NEW">
<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15089">Issue-15089</a>
<div class="issue-details">
<p class="short-desc">shrink-to-fit circle / shape</p>
</div>
</div>
<dfn title="outside-inside">Outside and inside</dfn>
<p>
In this specification, 'outside' refers to DOM content that is not a descendant of an element
while 'inside' refers to the element's descendants.
</p>
(cut from shapes definitions)
The inside shape defines an element's <span>content shape</span> and the element's inline
content will flow within that shape.
<p class="note">It is important to note that while outside shapes only apply to floats, inside shapes apply to all block-level elements.</p>
(cut from shapes intro)
<div class="example">
<p>
CSS 'shape-outside' and CSS box model relation:
the red box illustrates the exclusion element's
content box, which is unmodified and subject to normal CSS positioning (here absolute positioning).</p>
<pre><code class="html">
<style type="text/css">
.exclusion {
wrap-flow: both;
position: absolute;
top: 25%;
left: 25%;
width: 50%;
height: 50%;
shape-outside: circle(50%, 50%, 50%);
border: 1px solid red;
}
</style>
<div style=”position: relative;”>
<div class=”exclusion”></div>
Lorem ipsum dolor sit amet...
</div>
</code></pre>
<img class="singleImgExample" src="images/shapes_CSS2.1_MBP.png" alt="Example rendering of circle shape and box model." style="max-width:40%"/>
</div>
(cut exclusion example from shapes intro)
<p class="note">
Note, images can define cavities and inline flow content should wrap inside
them. In order to avoid that, another exclusion element can be overlaid.
</p>
(cut from Shapes from Image)
<p>
The shape defined by the 'shape-inside'
and 'shape-padding' properties
defines an <span>exclusion area</span>
that contributes
to the element's <span>wrapping context</span>.
The 'shape-inside' property applies
to all block-level elements.
</p>
(cut from Declaring Shapes, along with shape-inside references)
The shape is computed
based on the border box of the element for exclusions,
or computed based on the margin box for floats.
(cut from shape-outside:auto definition)
<div class='figure'>
<img alt="arbitrary shapes for exclusions. Illustrates how content flows around shapes" src="images/shapes-exclusions.png" width="70%"/>
<p class="caption">Arbitrary shapes for exclusions</p>
</div>
<div>
<p>The above figure shows how
'shape-outside' shapes
impact the <span>exclusion areas</span>.
The red box represents an element's content box
and 'A', 'B', 'C' and 'C' represent exclusions
with a complex shape
and their 'wrap-flow' property
computes to 'both', 'start', 'end' and 'clear',
respectively.</p>
<p>As illustrated in the picture,
when an exclusion allows wrapping
on all sides,
text can flow inside 'holes'
in the exclusion
(as for exclusion 'A').
Otherwise, the exclusion clears
the area on the side(s)
defined by 'wrap-flow',
as illustrated
for 'B', 'C' and 'D' above.</p>
</div>
(cut from shape-outside)
<h4 id="shape-inside-property">The 'shape-inside' Property</h4>
<p>
The 'shape-inside' property adds
one or more exclusion areas
to the element's wrapping context.
This modifies the normal rectangular shape
of the content area
to a possibly non-rectangular wrapping area.
The exclusion areas
are defined by subtracting the shape
from the element's content area.
Any part of the shape outside
the element's content area
has no effect.
</p>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'shape-inside'">shape-inside</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var>outside-shape</var> | <var>auto</var> | <var><basic-shape></var> | <var><uri></var></td>
</tr>
<tr>
<th>Initial:</th>
<td>outside-shape</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Computed value:</th>
<td>computed lengths for <basic-shape>, the absolute URI for <uri>, otherwise as specified</td>
</tr>
</table>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><dfn title="'shape-inside'!!'outside-shape'">outside-shape</dfn></dt>
<dd>
The shape is computed
based on the computed value
of the 'shape-outside' property.
E.g., when shape-outside
computes to 'auto',
use the meaning of 'auto' below
to compute the shape.
</dd>
</dl>
<dl>
<dt><dfn title="'shape-inside'!!'auto'">auto</dfn></dt>
<dd>
The shape is computed based on the content box of the element.
</dd>
</dl>
<dl>
<dt><dfn title="'shape-inside'!!'<basic-shape>'"><basic-shape></dfn></dt>
<dd>
The shape is computed based on the values of one of 'rectangle', 'inset-rectangle', 'circle', 'ellipse'
or 'polygon'.
</dd>
</dl>
<dl>
<dt><dfn title="'shape-inside'!!'<uri>'"><uri></dfn></dt>
<dd>
If the <uri> references an SVG shape element, that element defines the shape.
Otherwise, if the <uri> references an image, the shape is extracted and computed
based on the alpha channel of the specified image.
If the <uri> does not reference an SVG shape element or an image, the
effect is as if the value 'auto' had been specified.
</dd>
</dl>
<p>The 'shape-inside' property applies to floats.</p>
<p>The 'shape-inside' property may not apply on some elements such as elements with a
computed 'display' value of 'table'.</p>
<div class='figure'>
<img alt="Content flowing with and without a shape-inside" src="images/shape-inside-content.png"/>
<p class="caption">Effect of shape-inside on inline content.</p>
</div>
<p>Overflow content avoids
the exclusion area(s) added
by 'shape-inside' and 'shape-padding'
(as well as any other exclusion areas
in the element's wrapping context).</p>
<div class='figure'>
<img alt="Overflow interacting with rounded rect" style="display:inline-block;vertical-align:top" src="images/rounded-rect-overflow.png"/>
<img alt="Overflow interacting with ellipse" style="display:inline-block;vertical-align:top" src="images/ellipse-overflow.png"/>
<p class="caption">Overflow interacting with exclusion areas defined by 'shape-inside' and 'shape-padding'.</p>
</div>
<!-- End section "The shape-inside property" -->
The 'shape-image-threshold'
applies to both 'shape-outside' and 'shape-inside'.
(cut from shape-image-threshold)
<h4 id="shape-padding-property">The 'shape-padding' Property</h4>
<p>
The 'shape-padding' property adds padding to a shape-inside.
This defines a new shape where every point
is the specified distance from the shape-inside.
This property takes on positive values only.
</p>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'shape-padding'">shape-padding</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var><length></var></td>
</tr>
<tr>
<th>Initial:</th>
<td>0</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Computed value:</th>
<td>the absolute length</td>
</tr>
</table>
<div class="example">
<p>A 'shape-padding' creating an offset
from a circular shape-inside.
The light blue rectangles represent
inline content affected
by the shape created
by the padding.</p>
<img src="images/shape-padding.png"
alt="Example of a shape-padding offset"/>
</div>
<!-- End section "shape-padding property" -->
<div class="note">Note that the 'shape-padding' property only affects layout of content inside
the element it applies to while the 'shape-margin' property only affects layout of content
outside the element.</div>