-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
1425 lines (1225 loc) · 78.6 KB
/
Overview.html
File metadata and controls
1425 lines (1225 loc) · 78.6 KB
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html><html lang=en><head>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Shapes Module Level 1</title>
<link href=../default.css rel=stylesheet type=text/css>
<link href=../csslogo.ico rel="shortcut icon" type=image/x-icon>
<style>
body {
background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat white;
background-attachment: fixed;
color: black;
font-family: sans-serif;
margin: 0 auto;
max-width: 50em;
padding: 2em 1em 2em 70px;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
a[href]:active { color: #C00; background: transparent }
a[href]:hover { background: #ffa }
a[href] img { border-style: none }
h1, h2, h3, h4, h5, h6 { text-align: left }
h1, h2, h3 { color: #005A9C; }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif }
.hide { display: none }
div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
p.copyright { font-size: small }
p.copyright small { font-size: small }
pre { margin-left: 2em }
dt { font-weight: bold }
ul.toc, ol.toc {
list-style: none;
}
</style>
<script defer src=//test.csswg.org/harness/annotate.js#css-shapes-1_dev/css-shapes-1 type=text/javascript></script>
<style type=text/css>
.singleImgExample {
display: block;
margin: auto;
}
</style>
</head>
<body class=h-entry>
<div class=head>
<p data-fill-with=logo><a class=logo href=http://www.w3.org/>
<img alt=W3C height=48 src=https://www.w3.org/Icons/w3c_home width=72>
</a>
</p>
<h1 class="p-name no-ref" id=title>CSS Shapes Module Level 1</h1>
<h2 class="no-num no-toc no-ref heading settled" id=subtitle><span class=content>Editor’s Draft,
<span class=dt-updated><span class=value-title title=20140907>7 September 2014</span></span></span></h2>
<div data-fill-with=spec-metadata><dl>
<dt>This version:
<dd><a class=u-url href=http://dev.w3.org/csswg/css-shapes/>http://dev.w3.org/csswg/css-shapes/</a>
<dt>Latest version:
<dd><a href=http://www.w3.org/TR/css-shapes/>http://www.w3.org/TR/css-shapes/</a>
<dt>Feedback:
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-shapes%5D%20feedback">www-style@w3.org</a>
with subject line
“<kbd>[css-shapes] <var>… message topic …</var></kbd>”(<a href=http://lists.w3.org/Archives/Public/www-style/ rel=discussion>archives</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>Editors:
<dd><div class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:vhardy@adobe.com>Vincent Hardy</a> (<span class="p-org org">Adobe Systems, Inc.</span>)</div>
<dd><div class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:ratan@microsoft.com>Rossen Atanassov</a> (<span class="p-org org">Microsoft Corporation</span>)</div>
<dd><div class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:stearns@adobe.com>Alan Stearns</a> (<span class="p-org org">Adobe Systems, Inc.</span>)</div>
<dt>Issues list:
<dd><a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&product=CSS&component=Shapes&resolution=---&cmdtype=doit">In Bugzilla</a>
</dl>
</div>
<div data-fill-with=warning></div>
<p class=copyright data-fill-with=copyright><a href=http://www.w3.org/Consortium/Legal/ipr-notice#Copyright>Copyright</a> © 2014 <a href=http://www.w3.org/><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href=http://www.csail.mit.edu/><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href=http://www.ercim.eu/><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href=http://www.keio.ac.jp/>Keio</a>, <a href=http://ev.buaa.edu.cn/>Beihang</a>), All Rights Reserved. W3C <a href=http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer>liability</a>, <a href=http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks>trademark</a> and <a href=http://www.w3.org/Consortium/Legal/copyright-documents>document use</a> rules apply.
</p>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled" id=abstract><span class=content>Abstract</span></h2>
<div class=p-summary data-fill-with=abstract><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 title=wrap>wrap</a> around the circle shape instead of the float’s bounding box.</p>
<a href=http://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, in speech, etc.</div>
<h2 class="no-num no-toc no-ref heading settled" id=status><span class=content>Status of this document</span></h2>
<div data-fill-with=status><p>
This is a public copy of the editors’ draft.
It is provided for discussion only and may change at any moment.
Its publication here does not imply endorsement of its contents by W3C.
Don’t cite this document other than as work in progress.
<p>
The (<a href=http://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>
(see <a href=http://www.w3.org/Mail/Request>instructions</a>)
is preferred for discussion of this specification.
When sending e-mail,
please put the text “css-shapes” in the subject,
preferably like this:
“[css-shapes] <em>…summary of comment…</em>”
<p>
This document was produced by the <a href=http://www.w3.org/Style/CSS/members>CSS Working Group</a>
(part of the <a href=http://www.w3.org/Style/>Style Activity</a>).
<p>
This document was produced by a group operating under
the <a href=http://www.w3.org/Consortium/Patent-Policy-20040205/>5 February 2004 W3C Patent Policy</a>.
W3C maintains a <a href=http://www.w3.org/2004/01/pp-impl/32061/status 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=http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential>Essential Claim(s)</a>
must disclose the information in accordance with <a href=http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure>section 6 of the W3C Patent Policy</a>.</div>
<div data-fill-with=at-risk></div>
<h2 class="no-num no-toc no-ref heading settled" id=contents><span class=content>Table of Contents</span></h2>
<div data-fill-with=table-of-contents><ul class=toc>
<li><a href=#intro><span class=secno>1</span> Introduction</a>
<ul class=toc>
<li><a href=#module-interactions><span class=secno>1.1</span> Module Interactions</a>
<li><a href=#values><span class=secno>1.2</span> Values</a>
<li><a href=#animations><span class=secno>1.3</span> Animated Values</a>
<li><a href=#terminology><span class=secno>1.4</span> Terminology</a></ul>
<li><a href=#relation-to-box-model-and-float-behavior><span class=secno>2</span> Relation to the box model and float behavior</a>
<li><a href=#basic-shape-functions><span class=secno>3</span> Basic Shapes</a>
<ul class=toc>
<li><a href=#supported-basic-shapes><span class=secno>3.1</span> Supported Shapes</a>
<li><a href=#basic-shape-computed-values><span class=secno>3.2</span> Computed Values of Basic Shapes</a>
<li><a href=#basic-shape-serialization><span class=secno>3.3</span> Serialization of Basic Shapes</a>
<li><a href=#basic-shape-interpolation><span class=secno>3.4</span> Interpolation of Basic Shapes</a></ul>
<li><a href=#shapes-from-image><span class=secno>4</span> Shapes from Image</a>
<li><a href=#shapes-from-box-values><span class=secno>5</span> Shapes from Box Values</a>
<li><a href=#declaring-shapes><span class=secno>6</span> Declaring Shapes</a>
<ul class=toc>
<li><a href=#shape-outside-property><span class=secno>6.1</span> Float Area Shape: the <span class=property data-link-type=propdesc title=shape-outside>shape-outside</span> property</a>
<li><a href=#shape-image-threshold-property><span class=secno>6.2</span> Choosing Image Pixels: the <span class=property data-link-type=propdesc title=shape-image-threshold>shape-image-threshold</span> property</a>
<li><a href=#shape-margin-property><span class=secno>6.3</span> Embiggening a Shape: the <span class=property data-link-type=propdesc title=shape-margin>shape-margin</span> property</a></ul>
<li><a href=#acknowledgments><span class=secno></span> Acknowledgments</a>
<li><a href=#change-log><span class=secno></span> Change Log</a>
<ul class=toc>
<li><a href=#201402110><span class=secno></span> Since <span>March 20th 2014</span></a>
<li><a href=#20140211><span class=secno></span> Since <span>February 11th 2014</span></a>
<li><a href=#20131203><span class=secno></span> Since <span>December 3rd 2013</span></a>
<li><a href=#20130620><span class=secno></span> Since <span>June 20th 2013</span></a>
<li><a href=#20120503><span class=secno></span> Since <span>May 3rd 2012</span></a>
<li><a href=#20111213><span class=secno></span> Since <span>December 13th 2011</span></a></ul>
<li><a href=#conformance><span class=secno></span> Conformance</a>
<ul class=toc>
<li><a href=#conventions><span class=secno></span> Document conventions</a>
<li><a href=#conformance-classes><span class=secno></span> Conformance classes</a>
<li><a href=#partial><span class=secno></span> Partial implementations</a>
<li><a href=#experimental><span class=secno></span> Experimental implementations</a>
<li><a href=#testing><span class=secno></span> Non-experimental implementations</a></ul>
<li><a href=#references><span class=secno></span> References</a>
<ul class=toc>
<li><a href=#normative><span class=secno></span> Normative References</a>
<li><a href=#informative><span class=secno></span> Informative References</a></ul>
<li><a href=#index><span class=secno></span> Index</a>
<li><a href=#property-index><span class=secno></span> Property index</a></ul></div>
<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 title="float area">float area</a>.
The <a class=property data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a> property uses shape values
to define the <a data-link-type=dfn href=#float-area title="float area">float area</a> for a float.</p>
<p class=note>Note: 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-biblio-type=informative data-link-type=biblio href=#css-masking title=biblio-CSS-MASKING>[CSS-MASKING]</a>
and CSS Exclusions <a data-biblio-type=informative data-link-type=biblio href=#css3-exclusions title=biblio-CSS3-EXCLUSIONS>[CSS3-EXCLUSIONS]</a>.</p>
<p class=note>Note: If a user agent implements both CSS Shapes
and CSS Exclusions,
the <a class=property data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a> property defines
the exclusion area for an exclusion.</p>
<p class=note>Note: 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 title=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-biblio-type=normative data-link-type=biblio href=#css21 title=biblio-CSS21>[CSS21]</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 CSS property definition conventions from <a data-biblio-type=normative data-link-type=biblio href=#css21 title=biblio-CSS21>[CSS21]</a>. Value types not defined in these specifications are defined in CSS Values and Units Module Level 3 <a data-biblio-type=normative data-link-type=biblio href=#css3val title=biblio-CSS3VAL>[CSS3VAL]</a>.</p>
<p>In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the inherit keyword as their property value. For readability it has 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.
(The section
<a href=http://www.w3.org/TR/css3-transitions/#animatable-types>"Animation of property types"</a>
of the <cite>CSS Transitions module</cite> <a data-biblio-type=informative data-link-type=biblio href=#css3-transitions title=biblio-CSS3-TRANSITIONS>[CSS3-TRANSITIONS]</a>
is expected to define how different kinds
of values are interpolated during a transition.)
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 data-dfn-type=dfn data-noexport="" id=wrap>Wrap<a class=self-link href=#wrap></a></dfn></p>
<p>This specification uses the term <a data-link-type=dfn href=#wrap title=wrap>wrap</a>
to refer to flowing content
around the sides of a <a data-link-type=dfn href=#float-area title="float area">float area</a>,
defined in <a data-biblio-type=normative data-link-type=biblio href=#css21 title=biblio-CSS21>[CSS21]</a> chapter 9.
Content <a data-link-type=dfn href=#wrap title=wrap>wraps</a> around the right side
of a left-floated box,
and content <a data-link-type=dfn href=#wrap title=wrap>wraps</a> around the left side
of a right-floated box.
One result of this <a data-link-type=dfn href=#wrap title=wrap>wrapping</a>
is that line boxes next to a float
are shortened as necessary
to avoid intersections with the <a data-link-type=dfn href=#float-area title="float area">float area</a>.</p>
<p><dfn data-dfn-type=dfn data-noexport="" id=float-area>Float area<a class=self-link href=#float-area></a></dfn></p>
<p>The area used
for <a data-link-type=dfn href=#wrap title=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 title="float area">float area</a>
to determine where content flows.
By default,
the <a data-link-type=dfn href=#float-area title="float area">float area</a> is the float element’s
<a href=http://www.w3.org/TR/CSS2/box.html#box-dimensions>margin box</a>
(note this can be different than
the <a data-link-type=dfn href=#float-area title="float area">float area</a> produced
by the <span class=css>margin-box</span> value,
which includes border-radius curvature).
This specification’s <a class=property data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a> property
can be used to define an arbitrary,
non-rectangular <a data-link-type=dfn href=#float-area title="float area">float area</a>.</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 title=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-biblio-type=normative data-link-type=biblio href=#css3box title=biblio-CSS3BOX>[CSS3BOX]</a> module.
Also, float positioning and stacking are not affected
by defining a <a data-link-type=dfn href=#float-area title="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 title="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 <a data-link-type=dfn href=#float-area title="float area">float area</a>,
not increase it.
A reduced <a data-link-type=dfn href=#float-area title="float area">float area</a> may have no effect
on some line boxes
that would normally be affected by the float.
An <dfn data-dfn-type=dfn data-noexport="" id=empty-float-area>empty float area<a class=self-link href=#empty-float-area></a></dfn>
(where the shape encloses no area)
has no effect on line boxes.</p>
<p>A <a data-link-type=dfn href=#float-area title="float area">float area</a> defined by a shape
may reduce the normal <a data-link-type=dfn href=#float-area title="float area">float area</a> on all sides,
but this does not allow content to <a data-link-type=dfn href=#wrap title=wrap>wrap</a>
on both sides of a float.
Left floats with a <a class=property data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a> still
only allow content <a data-link-type=dfn href=#wrap title=wrap>wrapping</a> on the right side,
and right floats only allow <a data-link-type=dfn href=#wrap title=wrap>wrapping</a> on the left.</p>
<div class=example>
<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 data-link-type=propdesc href=#propdef-shape-outside title=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 src=images/hand-funnel.png></p>
</div>
<div class=example>
<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>
<p>A shape with no extent will create
a <a data-link-type=dfn href=#float-area title="float area">float area</a> with no extent.
Because <a data-link-type=dfn href=#wrap title=wrap>wrapping</a> only considers the <a data-link-type=dfn href=#float-area title="float area">float area</a>,
either shape below applied to a float
will allow inline content
to flow through all of the float’s box.</p>
<pre><code>
shape-outside: inset(50% 50% 50% 50%);
shape-outside: inset(150% 150% 0% 0%);
</code>
</pre>
</div>
<div class=example>
<p>A <a class=property data-link-type=propdesc href=#propdef-shape-outside title=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 title="float area">float area</a>.
Content still <a data-link-type=dfn href=#wrap title=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 src=images/float-side-example.png></p>
</div>
<div class=example>
<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 title=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 src=images/float-margin-example.png></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 title="float area">float area</a>.</p>
<p><img alt="Stacking two floats with a small shape-outside" class=singleImgExample src=images/stacked-float-example.png></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=css data-dfn-type=type data-export="" id=typedef-basic-shape><basic-shape><a class=self-link href=#typedef-basic-shape></a></dfn> type
can be specified using basic shape functions.
When using this syntax
to define shapes,
the <dfn data-dfn-type=dfn data-noexport="" id=reference-box>reference box<a class=self-link href=#reference-box></a></dfn> is defined
by each property that uses
<a class="production css" data-link-type=type href=#typedef-basic-shape title="<basic-shape>"><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=#reference-box title="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 <a data-link-type=dfn href=#reference-box title="reference box">reference box</a>.</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 title="<basic-shape>"><basic-shape></a> values use
<a href=http://www.w3.org/TR/css3-values/#functional-notation>functional notation</a>
and are defined here using the
<a href=http://www.w3.org/TR/css3-values/#value-defs>Value Definition Syntax</a>.</p>
<dl>
<dt><dfn class=css data-dfn-type=function data-export="" id=funcdef-inset>inset()<a class=self-link href=#funcdef-inset></a></dfn> =
inset( <a class="production css" data-link-type=type href=#typedef-shape-arg title="<shape-arg>"><shape-arg></a>{1,4} [round <<a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#border-radius title=border-radius>border-radius</a>>]? )
</dt>
<dd>
Defines an inset rectangle.
<ul>
<li>
When all of the first four arguments
are supplied they represent the
<strong>top, right, bottom</strong> and
<strong>left</strong> offsets
from the <a data-link-type=dfn href=#reference-box title="reference box">reference box</a> inward
that define the positions
of the edges
of the inset rectangle.
These arguments follow the syntax
of the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css2/box.html#propdef-margin title=margin>margin</a> shorthand,
that let you set all four insets
with one, two or four values.
</li>
<li>
The optional <a class=production data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#border-radius title=border-radius><‘border-radius’></a> argument(s)
define rounded corners for the inset rectangle
using the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#border-radius title=border-radius>border-radius</a> shorthand syntax.
</li>
</ul>
<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)
define a shape enclosing no area.
For this specification,
this results in an <a data-link-type=dfn href=#empty-float-area title="empty float area">empty float area</a>.</p>
</dd>
<dt><dfn class=css data-dfn-type=function data-export="" id=funcdef-circle>circle()<a class=self-link href=#funcdef-circle></a></dfn> =
circle( [<a class="production css" data-link-type=type href=#typedef-shape-radius title="<shape-radius>"><shape-radius></a>]? [at <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-3/#position title="<position>"><position></a>]? )
</dt>
<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=#reference-box title="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>
<li>
The position argument defines
the center of the circle.
This defaults to center if omitted.
</li>
</ul>
</dd>
<dt><dfn class=css data-dfn-type=function data-export="" id=funcdef-ellipse>ellipse()<a class=self-link href=#funcdef-ellipse></a></dfn> =
ellipse( [<a class="production css" data-link-type=type href=#typedef-shape-radius title="<shape-radius>"><shape-radius></a>{2}]? [at <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-3/#position title="<position>"><position></a>]? )
</dt>
<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>
<li>
The position argument defines
the center of the ellipse.
This defaults to center if omitted.
</li>
</ul>
</dd>
<dt><dfn class=css data-dfn-type=function data-export="" id=funcdef-polygon>polygon()<a class=self-link href=#funcdef-polygon></a></dfn> =
polygon( [<a class="production css" data-link-type=type href=#typedef-fill-rule title="<fill-rule>"><fill-rule></a>,]? [<a class="production css" data-link-type=type href=#typedef-shape-arg title="<shape-arg>"><shape-arg></a> <a class="production css" data-link-type=type href=#typedef-shape-arg title="<shape-arg>"><shape-arg></a>]# )
</dt>
<dd>
<ul>
<li>
<dfn class=css data-dfn-type=type data-export="" id=typedef-fill-rule><a class="production css" data-link-type=type href=#typedef-fill-rule title="<fill-rule>"><fill-rule></a><a class=self-link href=#typedef-fill-rule></a></dfn> -
The filling rule used
to determine the interior
of the polygon.
See <a href=http://www.w3.org/TR/SVG/painting.html#FillRuleProperty>fill-rule</a> property
in SVG for details.
Possible values are <span class=css>nonzero</span>
or <span class=css>evenodd</span>.
Default value when omitted is <span class=css>nonzero</span>.</li>
<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.
</li>
</ul>
<p>The UA must close a polygon
by connecting the last vertex
with the first vertex of the list.</p>
<p>At least three vertices are required
to define a polygon with an area.
This means that (for this specification)
polygons with less than three vertices
(or with three or more vertices
arranged to enclose no area)
result in an <a data-link-type=dfn href=#empty-float-area title="empty float area">empty float area</a>.</p>
</dd>
</dl>
<p>The arguments not defined above are defined as follows:</p>
<dl>
<dt><dfn class=css data-dfn-type=type data-export="" id=typedef-shape-arg><a class="production css" data-link-type=type href=#typedef-shape-arg title="<shape-arg>"><shape-arg></a><a class=self-link href=#typedef-shape-arg></a></dfn> = <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> | <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#percentage-value title="<percentage>"><percentage></a>
</dt>
<dt><dfn class=css data-dfn-type=type data-export="" id=typedef-shape-radius><a class="production css" data-link-type=type href=#typedef-shape-radius title="<shape-radius>"><shape-radius></a><a class=self-link href=#typedef-shape-radius></a></dfn> = <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> | <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#percentage-value title="<percentage>"><percentage></a> | closest-side | farthest-side
</dt>
<dd>
Defines a radius for a circle or ellipse. If omitted it defaults to closest-side.
<ul>
<li>
<dfn data-dfn-type=dfn data-noexport="" id=closest-side>closest-side<a class=self-link href=#closest-side></a></dfn>
uses the length from the center
of the shape to the closest side
of the <a data-link-type=dfn href=#reference-box title="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>
<li>
<dfn data-dfn-type=dfn data-noexport="" id=farthest-side>farthest-side<a class=self-link href=#farthest-side></a></dfn>
uses the length from the center
of the shape to the farthest side
of the <a data-link-type=dfn href=#reference-box title="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.</li>
</ul>
</dd>
</dl>
<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 title="<basic-shape>"><basic-shape></a> function are computed as specified, with these exceptions:</p>
<ul>
<li>
Omitted values are included and compute to their defaults.
</li>
<li>
A <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-3/#position title="<position>"><position></a> value in <a class=css data-link-type=maybe href=#funcdef-circle title=circle()>circle()</a> or <a class=css data-link-type=maybe href=#funcdef-ellipse title=ellipse()>ellipse()</a> is computed as a pair of offsets (horizontal then vertical) from the top left origin, each given as a combination of an absolute length and a percentage.
</li>
<li>
A <<a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#border-radius title=border-radius>border-radius</a>> value in <a class=css data-link-type=maybe href=#funcdef-inset title=inset()>inset()</a> is computed as an expanded list of all eight <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> or percentage values.
</li>
</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 title="<basic-shape>"><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>
<p>The <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-3/#position title="<position>"><position></a> values in <a class=css data-link-type=maybe href=#funcdef-ellipse title=ellipse()>ellipse()</a> and <a class=css data-link-type=maybe href=#funcdef-circle title=circle()>circle()</a>
serialize to their 2- and 4-value forms only,
preferring the 2-value form
when it can be expressed without calc(),
preferring left and top origins,
and preferring 0% over a zero length.</p>
<div class=example>
<p>Since <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-3/#position title="<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=http://dev.w3.org/csswg/css-backgrounds-3/#position title="<position>"><position></a> always uses the 2- or 4-value form, a default <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-3/#position title="<position>"><position></a> 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=http://dev.w3.org/csswg/css-backgrounds-3/#position title="<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=http://dev.w3.org/csswg/css-backgrounds-3/#position title="<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
as a <a href=http://www.w3.org/TR/css3-transitions/#animtype-simple-list>simple list</a>.
The list values interpolate as
<a href=http://www.w3.org/TR/css3-transitions/#animtype-lpcalc>length,
percentage, or calc</a> where possible.
If list values are not one of those types
but are identical
(such as finding <span class=css>nonzero</span>
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=#reference-box title="reference box">reference box</a>.
</li>
<li>
If both shapes are the same type,
that type is <a class=css data-link-type=maybe href=#funcdef-ellipse title=ellipse()>ellipse()</a> or <a class=css data-link-type=maybe href=#funcdef-circle title=circle()>circle()</a>,
and none of the radii use
the <span class=css>closest-side</span> or <span class=css>farthest-side</span> keywords,
interpolate between each value
in the shape functions.
</li>
<li>
If both shapes are of type <a class=css data-link-type=maybe href=#funcdef-inset title=inset()>inset()</a>,
interpolate between each value
in the shape functions.
</li>
<li>
If both shapes are of type <a class=css data-link-type=maybe href=#funcdef-polygon title=polygon()>polygon()</a>,
both polygons have the same number of vertices,
and use the same <a class="production css" data-link-type=type href=#typedef-fill-rule title="<fill-rule>"><fill-rule></a>,
interpolate between each value
in the shape functions.
</li>
<li>
In all other cases no interpolation is specified.
</li>
</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=http://dev.w3.org/csswg/css-images-3/#image-type title="<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 data-link-type=propdesc href=#propdef-shape-image-threshold title=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 <a data-link-type=dfn href=#empty-float-area title="empty float area">empty float area</a>.
If the <a class=property data-link-type=propdesc href=#propdef-shape-image-threshold title=shape-image-threshold>shape-image-threshold</a> 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=http://www.w3.org/Graphics/GIF/spec-gif89a.txt>GIF</a>),
the first frame of the animation sequence is used.</p>
<div class=example>
<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 title="float area">float area</a>
through the <a class=property data-link-type=propdesc href=#propdef-shape-outside title=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 data-link-type=propdesc href=#propdef-shape-outside title=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 title="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>
<li>Changing the value of the <a class=property data-link-type=propdesc href=#propdef-shape-image-threshold title=shape-image-threshold>shape-image-threshold</a> property</li>
<li>Changing the value of the <a class=property data-link-type=propdesc href=#propdef-shape-margin title=shape-margin>shape-margin</a> property (see example 8)</li>
</ol>
<figure>
<img alt="A float shape around an image using its alpha-channel" src=images/shape-outside-image.png style=width:70%>
<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=http://www.w3.org/TR/CSS21/box.html#box-dimensions>CSS Box Model</a>.
These edges include
<a href=http://www.w3.org/TR/css3-background/#corner-shaping>border-radius curvature</a> <a data-biblio-type=normative data-link-type=biblio href=#css3bg title=biblio-CSS3BG>[CSS3BG]</a>
from the used border-radius values.
The <a class="production css" data-link-type=type href=#typedef-shape-box title="<shape-box>"><shape-box></a> value extends the <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-3/#box title="<box>"><box></a> value
to include <span class=css>margin-box</span>.
Its syntax is:</p>
<pre><dfn class=css data-dfn-type=type data-export="" id=typedef-shape-box><a class="production css" data-link-type=type href=#typedef-shape-box title="<shape-box>"><shape-box></a><a class=self-link href=#typedef-shape-box></a></dfn> = <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-3/#box title="<box>"><box></a> | <span class=css>margin-box</span>
</pre>
<p>The definitions of the values are:</p>
<p>The <dfn data-dfn-type=dfn data-noexport="" id=margin-box>margin-box<a class=self-link href=#margin-box></a></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,
then the margin box corner radius is
<code>border-radius + margin</code>.
If the ratio of <code>border-radius/margin</code> is less than 1,
then the margin box corner radius is
<code>border-radius + (margin * (1 + (ratio-1)^3))</code>.</p>
<p>The <dfn data-dfn-type=dfn data-noexport="" id=border-box>border-box<a class=self-link href=#border-box></a></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 data-dfn-type=dfn data-noexport="" id=padding-box>padding-box<a class=self-link href=#padding-box></a></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 data-dfn-type=dfn data-noexport="" id=content-box>content-box<a class=self-link href=#content-box></a></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>
<p>Given the 100px square below with
10px padding, border and margins,
the box values define these shapes:</p>
<ul>
<li><span class=css>margin-box</span>: the shape containing all of the yellow pixels</li>
<li><span class=css>border-box</span>: the shape containing all of the black pixels</li>
<li><span class=css>padding-box</span>: the shape containing all of the mauve pixels</li>
<li><span class=css>content-box</span>: the shape containing all of the blue pixels</li>
</ul>
<figure>
<img alt="Colored boxes representing simple box edges" src=images/box-edges-simple.png>
<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" src=images/box-edges-complex.png>
<figcaption>
Complex CSS Box Model Edges
</figcaption>
</figure>
</div>
<div class=example>
<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" src=images/normal-wrap.png>
<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" src=images/margin-box-wrap.png>
<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 data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a> property,
with possible modifications
from the <a class=property data-link-type=propdesc href=#propdef-shape-margin title=shape-margin>shape-margin</a> property.
The shape defined by
the <a class=property data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a>
and <a class=property data-link-type=propdesc href=#propdef-shape-margin title=shape-margin>shape-margin</a> properties
changes the geometry
of a float element’s
<a data-link-type=dfn href=#float-area title="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 data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a> property</span><a class=self-link href=#shape-outside-property></a></h3>
<table class="definition propdef"><tr><th>Name:<td><dfn class=css data-dfn-type=property data-export="" id=propdef-shape-outside>shape-outside<a class=self-link href=#propdef-shape-outside></a></dfn><tr><th>Value:<td class=prod>none <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> [ <a class="production css" data-link-type=type href=#typedef-basic-shape title="<basic-shape>"><basic-shape></a> <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-any title=||>||</a> <a class="production css" data-link-type=type href=#typedef-shape-box title="<shape-box>"><shape-box></a> ] <a class=prod-punc data-link-type=grammar href=http://dev.w3.org/csswg/css-values-3/#comb-one title=|>|</a> <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-images-3/#image-type title="<image>"><image></a><tr><th>Initial:<td>none<tr><th>Applies to:<td>floats<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>as <a href=#basic-shape-computed-values>defined</a> for <a class="production css" data-link-type=type href=#typedef-basic-shape title="<basic-shape>"><basic-shape></a> (with <a class="production css" data-link-type=type href=#typedef-shape-box title="<shape-box>"><shape-box></a> following, if supplied), the <a class="production css" data-link-type=type href=http://dev.w3.org/csswg/css-images-3/#image-type title="<image>"><image></a> with its URI made absolute, otherwise as specified.<tr><th>Animatable:<td>as <a href=#basic-shape-interpolation>specified</a> for <a class="production css" data-link-type=type href=#typedef-basic-shape title="<basic-shape>"><basic-shape></a>, otherwise no</table>
<p>The values of this property have the following meanings:</p>
<dl data-dfn-for=shape-outside data-dfn-type=value>
<dt><dfn class=css data-dfn-for=shape-outside data-dfn-type=value data-export="" id=valdef-shape-outside-none>none<a class=self-link href=#valdef-shape-outside-none></a></dfn></dt>
<dd>
The <a data-link-type=dfn href=#float-area title="float area">float area</a> is unaffected.
</dd>
<dt><a class="production css" data-link-type=type href=#typedef-shape-box title="<shape-box>"><shape-box></a></dt>
<dd>
If one of these values is specified by itself
the shape is computed based on one of
<span class=css>margin-box</span>,
<span class=css>border-box</span>,
<span class=css>padding-box</span> or
<span class=css>content-box</span>
which use their respective boxes
including curvature from border-radius,
similar to <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-3/#background-clip title=background-clip>background-clip</a> <a data-biblio-type=normative data-link-type=biblio href=#css3bg title=biblio-CSS3BG>[CSS3BG]</a>.
</dd>
<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 title="<basic-shape>"><basic-shape></a><a class=self-link href=#valdef-shape-outside-basic-shape></a></dfn></dt>
<dd>
The shape is computed based on the values of one
of <a class=css data-link-type=maybe href=#funcdef-inset title=inset()>inset()</a>, <a class=css data-link-type=maybe href=#funcdef-circle title=circle()>circle()</a>, <a class=css data-link-type=maybe href=#funcdef-ellipse title=ellipse()>ellipse()</a>
or <a class=css data-link-type=maybe href=#funcdef-polygon title=polygon()>polygon()</a>. If a <a class="production css" data-link-type=type href=#typedef-shape-box title="<shape-box>"><shape-box></a> is also supplied, this defines the <a data-link-type=dfn href=#reference-box title="reference box">reference box</a> for the <a class="production css" data-link-type=type href=#typedef-basic-shape title="<basic-shape>"><basic-shape></a> function. If <a class="production css" data-link-type=type href=#typedef-shape-box title="<shape-box>"><shape-box></a> is not supplied, then the <a data-link-type=dfn href=#reference-box title="reference box">reference box</a> defaults to <span class=css>margin-box</span>.
</dd>
<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=http://dev.w3.org/csswg/css-images-3/#image-type title="<image>"><image></a><a class=self-link href=#valdef-shape-outside-image></a></dfn></dt>
<dd>
The shape is extracted
and computed based
on the alpha channel