forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverview.html
More file actions
1086 lines (942 loc) · 63.4 KB
/
Overview.html
File metadata and controls
1086 lines (942 loc) · 63.4 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
93D4
-left: 2em }
dt { font-weight: bold }
ul.toc, ol.toc {
list-style: none;
}
</style>
<script defer src=http://test.csswg.org/harness/annotate.js#css-shapes-1_dev type=text/javascript></script>
</head>
<body class=h-entry>
<style scoped type=text/css>
.singleImgExample {
display: block;
margin: auto;
}
</style>
<div class=head>
<p data-fill-with=logo><a class=logo href=http://www.w3.org/>
<img alt=W3C height=48 src=http://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 heading" id=subtitle><span class=content>Editor’s Draft,
<span class=dt-updated><span class=value-title title=20131111>11 November 2013</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>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-shapes/>http://dev.w3.org/csswg/css-shapes/</a>
<dt>Feedback:</dt>
<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/css3-regions/nightly-unstable/>http://test.csswg.org/suites/css3-regions/nightly-unstable/</a><dt>Editors:
<dd 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>)<dd 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>)<dd 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>)<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> © 2013 <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 heading" id=abstract><span class=content>Abstract</span></h2>
<p class=p-summary data-fill-with=abstract>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.
<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.</p>
<h2 class="no-num no-toc no-ref heading settled heading" 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 heading" 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=#terminology><span class=secno>1.3</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-shapes-from-svg-syntax><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-interpolation><span class=secno>3.2</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=#declaring-shapes><span class=secno>5</span>
Declaring Shapes</a><ul class=toc><li><a href=#shape-outside-property><span class=secno>5.1</span>
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>5.2</span>
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>5.3</span>
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=#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 heading" 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> 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 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=css-masking>[CSS-MASKING]</a>
and CSS Exclusions <a data-biblio-type=informative data-link-type=biblio href=#css3-exclusions title=css3-exclusions>[CSS3-EXCLUSIONS]</a>.
<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 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.
<h3 class="heading settled heading" 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=css21>[CSS21]</a> chapter 9.
<h3 class="heading settled heading" 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=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=css3val>[CSS3VAL]</a>.
<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.
<h3 class="heading settled heading" data-level=1.3 id=terminology><span class=secno>1.3 </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> 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=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> <dfn data-dfn-type=dfn data-noexport="" id=float-area>Float area<a class=self-link href=#float-area></a></dfn>
<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>.
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>.
<h2 class="heading settled heading" 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=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> 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 empty <a data-link-type=dfn href=#float-area title="float area">float area</a>
(where the shape encloses no area)
has no effect on line boxes.
<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.
<div class=example>
<p> In the following example
the left and right floating
<code class=html>div</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.
<pre><code class=css>
<div style="text-align:center;">
<div id="float-left"></div>
<div id="float-right"></div>
<div>
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.
</div>
</div>
<style type="text/css">
#float-left {
shape-outside: polygon(0 0, 100% 100%, 0 100%);
float: left;
width: 40%;
height: 12ex;
}
#float-right {
shape-outside: polygon(100% 0, 100% 100%, 0 100%);
float: right;
width: 40%;
height: 12ex;
}
</style>
</code>
</pre>
<p> <img alt="Using the shape-outside property with a float" class=singleImgExample src=images/float-shape-outside.png>
</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.
<pre><code class=css>
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>,
the shape below applied to a left float
will allow inline content
to flow through all of the float’s box.
<pre><code class=css>
shape-outside: inset(50% 50% 50% 50%);
</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.
<pre><code class=css>
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>
</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.
<pre><code class=css>
.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> 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> <img alt="Stacking two floats with a small shape-outside" class=singleImgExample src=images/stacked-float-example.png>
</div>
<h2 class="heading settled heading" data-level=3 id=basic-shapes-from-svg-syntax><span class=secno>3 </span><span class=content>
Basic Shapes</span><a class=self-link href=#basic-shapes-from-svg-syntax></a></h2>
<p> The <dfn class=css-code 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.
The definitions use the
<a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> and <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#percentage-value title="<percentage>"><percentage></a> types.
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-code" 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>.
<h3 class="heading settled heading" 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-code" 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>.
<dl>
<dt><dfn class=css-code data-dfn-type=function data-export="" id=funcdef-inset title=inset()>inset()<a class=self-link href=#funcdef-inset></a></dfn> =
inset( <a class="production css-code" 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-4/#border-radius title=border-radius>border-radius</a>>]? )
</dt>
<dd>
Defines an inset rectangle.
<ul>
<li>
The first four arguments 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://www.w3.org/TR/CSS21/box.html#propdef-margin title=margin>margin</a> shorthand,
that let you set all four insets
with one, two or four values.
Negative values for any
of these insets are invalid.
</li>
<li>
The optional <a class=production data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-4/#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-4/#border-radius title=border-radius>border-radius</a> shorthand syntax.
</li>
</ul>
</dd>
<dt><dfn class=css-code data-dfn-type=function data-export="" id=funcdef-circle title=circle()>circle()<a class=self-link href=#funcdef-circle></a></dfn> =
circle( [<a class="production css-code" data-link-type=type href=#typedef-shape-radius title="<shape-radius>"><shape-radius></a>] [at <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#position-value title="<position>"><position></a>]? | at <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#position-value title="<position>"><position></a> )
</dt>
<dd>
<ul>
<li>
The shape-radius argument represents
<strong>r</strong>, the radius
of the circle.
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>)**2 +
(<em>height</em>)**2))/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-code data-dfn-type=function data-export="" id=funcdef-ellipse title=ellipse()>ellipse()<a class=self-link href=#funcdef-ellipse></a></dfn> =
ellipse( [<a class="production css-code" data-link-type=type href=#typedef-shape-radius title="<shape-radius>"><shape-radius></a>{1,2}] [at <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#position-value title="<position>"><position></a>]? | at <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#position-value title="<position>"><position></a> )
</dt>
<dd>
<ul>
<li>
The shape-radius argument represent
<strong>rx</strong>, and
<strong>ry</strong>,
the x-axis and y-axis radii
of the ellipse.
</li>
<li>
The position argument defines
the center of the ellipse.
This defaults to center if omitted.
</li>
</ul>
</dd>
<dt><dfn class=css-code data-dfn-type=function data-export="" id=funcdef-polygon title=polygon()>polygon()<a class=self-link href=#funcdef-polygon></a></dfn> =
polygon( [<a class="production css-code" data-link-type=type href=#typedef-fill-rule title="<fill-rule>"><fill-rule></a>,]? [<a class="production css-code" data-link-type=type href=#typedef-shape-arg title="<shape-arg>"><shape-arg></a> <a class="production css-code" data-link-type=type href=#typedef-shape-arg title="<shape-arg>"><shape-arg></a>]# )
</dt>
<dd>
<ul>
<li>
<dfn class=css-code data-dfn-type=type data-export="" id=typedef-fill-rule><a class="production css-code" 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 data-link-type=maybe title=nonzero>nonzero</span>
or <span class=css data-link-type=maybe title=evenodd>evenodd</span>.
Default value when omitted is <span class=css data-link-type=maybe title=nonzero>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> 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 empty <a data-link-type=dfn href=#float-area title="float area">float area</a>,
which allows inline content
to flow through all
of the float’s box.
</dd>
</dl>
<p> The arguments not defined above are defined as follows:
<dl>
<dt><dfn class=css-code data-dfn-type=type data-export="" id=typedef-shape-arg><a class="production css-code" 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-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#percentage-value title="<percentage>"><percentage></a>
</dt>
<dt><dfn class=css-code data-dfn-type=type data-export="" id=typedef-shape-radius><a class="production css-code" 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-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> | <a class="production css-code" 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>
<strong>closest-side</strong>
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>
<strong>farthest-side</strong>
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 heading" data-level=3.2 id=basic-shape-interpolation><span class=secno>3.2 </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 described below are applied.
<p> <ul>
<li>
For interpolating between two shapes that are type inset rectangle, ellipse or circle:
<ul>
<li>
Replace each inset rectangle with a temporary inset rectangle with offsets relative to the margin-box.
</li>
<li>
Replace each circle and ellipse with a temporary inset rectangle with offsets relative to the margin-box, and <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-4/#border-radius title=border-radius>border-radius</a> values to make the inset rectangle equivalent to the original circle or ellipse
</li>
<li>
Interpolate between each value of the temporary inset rectangles.
</li>
</ul>
</li>
<li>
If both basic shapes are of type polygon
and if both polygons have the same number of vertices:
<ul>
<li>
If the polygons use a different <a data-link-type=dfn href=#reference-box title="reference box">reference box</a>, replace the second polygon with a temporary equivalent polygon that uses the <a data-link-type=dfn href=#reference-box title="reference box">reference box</a> of the first.
<li>
Interpolate between each value.
</li>
</ul>
</li>
<li>
In all other cases:
<ul>
<li>
No interpolation is specified.
</li>
</ul>
</li>
</ul>
<h2 class="heading settled heading" 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-code" 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
that encloses the area
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.
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> The image is sized and positioned
as if it were a replaced element
with a specified width and height
of the element’s used content-box size.
<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.
<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> 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.
<pre> <code class=css>
<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> 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> In the figure below, the alpha-channel threshold
is represented by the dotted line around the CSS logo.
<p> It’s then possible to affect where the lines
of the paragraph start in three ways:
<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>
<div class=figure>
<img alt="A float shape around an image using its alpha-channel" src=images/shape-outside-image.png style=width:70%>
<p class=caption>A float shape around an image using its alpha-channel.</p>
</div>
</div>
<h2 class="heading settled heading" data-level=5 id=declaring-shapes><span class=secno>5 </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>.
<h3 class="heading settled heading" data-level=5.1 id=shape-outside-property><span class=secno>5.1 </span><span class=content>
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-code 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>auto | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-4/#box title="<box>"><box></a> | [<a class="production css-code" data-link-type=type href=#typedef-basic-shape title="<basic-shape>"><basic-shape></a> || <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-4/#box title="<box>"><box></a>] | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-images-3/#image-type title="<image>"><image></a><tr><th>Initial:<td>auto<tr><th>Applies to:<td>floats<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>computed lengths for <a class="production css-code" data-link-type=type href=#typedef-basic-shape title="<basic-shape>"><basic-shape></a>, the <a class="production css-code" 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</table>
<p> The values of this property have the following meanings:
<dl data-dfn-for=shape-outside data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for=shape-outside data-dfn-type=value data-export="" id=valuedef-auto>auto<a class=self-link href=#valuedef-auto></a></dfn></dt>
<dd>
The <a data-link-type=dfn href=#float-area title="float area">float area</a> uses the margin box as normal.
</dd>
<dt><dfn class=css-code data-dfn-for=shape-outside data-dfn-type=value data-export="" id=valuedef-box><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-4/#box title="<box>"><box></a><a class=self-link href=#valuedef-box></a></dfn></dt>
<dd>
The shape is computed based on one of
<span class=css data-link-type=maybe title=margin-box>margin-box</span>,
<span class=css data-link-type=maybe title=border-box>border-box</span>,
<span class=css data-link-type=maybe title=padding-box>padding-box</span> or
<span class=css data-link-type=maybe title=content-box>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-4/#background-clip title=background-clip>background-clip</a> <a data-biblio-type=normative data-link-type=biblio href=#css3bg title=css3bg>[CSS3BG]</a>.
</dd>
<dt><dfn class=css-code data-dfn-for=shape-outside data-dfn-type=value data-export="" id=valuedef-basic-shape><a class="production css-code" data-link-type=type href=#typedef-basic-shape title="<basic-shape>"><basic-shape></a><a class=self-link href=#valuedef-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-code" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-4/#box title="<box>"><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-code" data-link-type=type href=#typedef-basic-shape title="<basic-shape>"><basic-shape></a> function. If <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-backgrounds-4/#box title="<box>"><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 data-link-type=maybe title=margin-box>margin-box</span>.
</dd>
<dt><dfn class=css-code data-dfn-for=shape-outside data-dfn-type=value data-export="" id=valuedef-image><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-images-3/#image-type title="<image>"><image></a><a class=self-link href=#valuedef-image></a></dfn></dt>
<dd>
The shape is extracted
and computed based
on the alpha channel
of the specified <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-images-3/#image-type title="<image>"><image></a>
as defined by <a class=property data-link-type=propdesc href=#propdef-shape-image-threshold title=shape-image-threshold>shape-image-threshold</a>.
<p> User agents must use the
<a href=http://www.w3.org/TR/html5/infrastructure.html#cors-enabled-fetch>potentially CORS-enabled fetch</a>
method defined by the <a data-biblio-type=normative data-link-type=biblio href=#html5 title=html5>[HTML5]</a> specification
for all URLs in a <a class=property data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a> value.
When fetching,
user agents must use "Anonymous" mode,
set the referrer source
to the stylesheet’s URL
and set the origin to the URL
of the containing document.
If this results in network errors
such that there is no valid fallback image,
the effect is as if
the value <a class=css-code data-link-for=shape-outside data-link-type=value href=#valuedef-auto title=auto>auto</a>
had been specified.
</dd>
</dl>
<h3 class="heading settled heading" data-level=5.2 id=shape-image-threshold-property><span class=secno>5.2 </span><span class=content>
The <a class=property data-link-type=propdesc href=#propdef-shape-image-threshold title=shape-image-threshold>shape-image-threshold</a> Property</span><a class=self-link href=#shape-image-threshold-property></a></h3>
<p> The <a class=property data-link-type=propdesc href=#propdef-shape-image-threshold title=shape-image-threshold>shape-image-threshold</a>
defines the alpha channel threshold
used to extract the shape
using an image.
A value of 0.5 means that
the shape will enclose
all the pixels
that are more than 50% opaque.
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-shape-image-threshold>shape-image-threshold<a class=self-link href=#propdef-shape-image-threshold></a></dfn><tr><th>Value:<td><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#number-value title="<number>"><number></a><tr><th>Initial:<td>0.0<tr><th>Applies to:<td>floats<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>The same as the specified value after clipping the <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#number-value title="<number>"><number></a> to the range [0.0,1.0]</table>
<p> The values of this property have the following meanings:
<dl data-dfn-for=shape-image-threshold data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for=shape-image-threshold data-dfn-type=value data-export="" id=valuedef-number><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#number-value title="<number>"><number></a><a class=self-link href=#valuedef-number></a></dfn></dt>
<dd>
Sets the threshold used
for extracting a shape
from an image.
The shape is defined
by the pixels whose alpha value
is greater than the threshold.
A threshold value outside the range
0.0 (fully transparent)
to 1.0 (fully opaque)
will be clamped to this range.
</dd>
</dl>
<p class=note> Note: A future level of CSS Shapes may define
a switch to use the luminance data
from an image instead of the alpha data.
When this happens,
shape-image-threshold will be extended
to apply its threshold
to either alpha or luminance,
depending on the switch state.
<h3 class="heading settled heading" data-level=5.3 id=shape-margin-property><span class=secno>5.3 </span><span class=content>
The <a class=property data-link-type=propdesc href=#propdef-shape-margin title=shape-margin>shape-margin</a> property</span><a class=self-link href=#shape-margin-property></a></h3>
<p> The <a class=property data-link-type=propdesc href=#propdef-shape-margin title=shape-margin>shape-margin</a> property adds
a margin to a <a class=property data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a>.
This defines a new shape
that is the smallest contour
(in the shrink-wrap sense)
that includes all the points
that are the <a class=property data-link-type=propdesc href=#propdef-shape-margin title=shape-margin>shape-margin</a> distance outward
in the perpendicular direction
from a point on the underlying shape.
Note that at points where
a perpendicular is not defined
(e.g. sharp points)
take all points
on the circle centered at the point
and with a radius of <a class=property data-link-type=propdesc href=#propdef-shape-margin title=shape-margin>shape-margin</a>.
This property takes only non-negative values.
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-shape-margin>shape-margin<a class=self-link href=#propdef-shape-margin></a></dfn><tr><th>Value:<td><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#percentage-value title="<percentage>"><percentage></a><tr><th>Initial:<td>0<tr><th>Applies to:<td>floats<tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>the absolute length</table>
<dl data-dfn-for=shape-margin data-dfn-type=value>
<dt><dfn class=css-code data-dfn-for=shape-margin data-dfn-type=value data-export="" id=valuedef-length><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a><a class=self-link href=#valuedef-length></a></dfn></dt>
<dd>
Sets the margin of the shape to the <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a>.
</dd>
<dt><dfn class=css-code data-dfn-for=shape-margin data-dfn-type=value data-export="" id=valuedef-percentage><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#percentage-value title="<percentage>"><percentage></a><a class=self-link href=#valuedef-percentage></a></dfn></dt>
<dd>
Sets the margin of the shape to a percentage
of the width of the shape’s <a data-link-type=dfn href=#reference-box title="reference box">reference box</a>.
</dd>
</dl>
<div class=example>
<p> A <a class=property data-link-type=propdesc href=#propdef-shape-margin title=shape-margin>shape-margin</a> creating an offset from a polygonal <a class=property data-link-type=propdesc href=#propdef-shape-outside title=shape-outside>shape-outside</a>. The lighter blue area shows the shape in a 100x100px float, and the darker blue area shows the 10px offset.
<pre> <code class=css>
.float {
shape-outside: polygon(10px 10px, 90px 50px, 40px 50px, 90px 90px, 10px 90px);
shape-margin: 10px;
}
</code>
</pre><p> <img alt="Example of a shape-margin offset" src=images/nepal-flag-shape.png>
</div>
<div class=example>
<p> If shape-margin is added
to the CSS logo from example 6,
the line boxes <a data-link-type=dfn href=#wrap title=wrap>wrapping</a>
around the shape are shortened further.
<pre> <code class=css>
#CSSlogo {
shape-margin: 35px;
}
</code>
</pre> <div class=figure>
<img alt="A float shape around an image using its alpha-channel with a 35 pixels shape-margin" src=images/shape-outside-image-with-margin.png style=width:70%>
<p class=caption>A float shape around an image using its alpha-channel with a 35-pixel <a class=property data-link-type=propdesc href=#propdef-shape-margin title=shape-margin>shape-margin</a></p>
</div>
</div>
<h2 class="no-num heading settled heading" id=acknowledgments><span class=content>
Acknowledgments</span><a class=self-link href=#acknowledgments></a></h2>
<p> This specification is made possible by input from
Andrei Bucur,
Alexandru Chiculita,
Elika Etemad,
Arron Eicholz,
Daniel Glazman,
Arno Gourdol,
Zoltan Horvath,
Chris Jones,
Bem Jones-Bey,
Marcus Mielke,
Alex Mogilevsky,
Hans Muller,
Mihnea Ovidenie,
Virgil Palanciuc,
Dirk Schulze,
Peter Sorotokin,
Bear Travis,
Eugene Veselov,
Stephen Zilles
and the CSS Working Group members.
<h2 class="no-num heading settled heading" id=change-log><span class=content>
Change Log</span><a class=self-link href=#change-log></a></h2>
<h3 class="no-num heading settled heading" id=20130620><span class=content>
Since <a href=http://www.w3.org/TR/2013/WD-css-shapes-1-20130620/>June 20th 2013</a></span><a class=self-link href=#20130620></a></h3>
<ul>
<li>Changed relevant to reference</li>
<li>Remove box-sizing dependency, add relevant box keywords</li>
<li>Changed circle() and ellipse() to use radial gradient syntax</li>
<li>Postponed rectangle() to level 2</li>
<li>Clarified shape-from-image sizing and positioning</li>
<li>Change inset-rectangle() to inset()</li>
<li>Much basic shape syntax bikeshedding</li>
<li>Use Concrete Object Size Resolution from CSS3-IMAGES in shape from image</li>
<li>Future-proof shape-image-threshold to possibly apply to luminance</li>
<li>Added CORS fetching to shape-outside URLs</li>
<li>Changed shape-outside value from <uri> to <image></li>
<li>Fixed basic shape grammar to use comma separators</li>
<li>Remove 'percentages based on auto-sizing resolve to 0'</li>
<li>Change initial value of shape-image-threshold to 0.0</li>
<li>Change float positioning to be unaffected by shape-outside</li>
<li>Shapes on floats clipped to float’s margin box</li>
<li>Inline content constrained to at least the float’s farthest margin edge</li>
</ul>
<h3 class="no-num heading settled heading" id=20120503><span class=content>
Since <a href=http://www.w3.org/TR/2012/WD-css3-exclusions-20120503/>May 3rd 2012</a></span><a class=self-link href=#20120503></a></h3>
<ul>
<li>Postpone shapes from SVG elements to a future Shapes level</li>
<li>Postpone shape-inside to a future Shapes level</li>
<li>split exclusions from shapes into separate modules</li>
<li>added inset-rectangle() to basic shapes</li>
<li>Changed shape-inside overflow diagrams to show exclusion behavior</li>
<li>Changed shape-inside to contribute to the wrapping context</li>
<li>Defined exclusion edges relative to wrapping content’s writing mode</li>
<li>Made use of start, end, before and after consistent</li>
<li>Added interpolation for basic shapes</li>
<li>Changed basic shapes to depend on box specified with box-sizing</li>
<li>Added overflow behavior for shape-inside.</li>
<li>Added wrap-flow:minimum.</li>
<li>Clarified processing model.</li>
<li>Changed wrap-margin and wrap-padding to shape-margin and shape-padding.</li>
<li>Removed wrap shorthand.</li>
</ul>
<h3 class="no-num heading settled heading" id=20111213><span class=content>
Since <a href=http://www.w3.org/TR/2011/WD-css3-exclusions-20111213/>December 13th 2011</a></span><a class=self-link href=#20111213></a></h3>
<ul>
<li>Clarified processing model.</li>
<li>Clarified interaction with floats.</li>
<li>Clarified that an exclusion element establishes a new block formatting context.</li>
</ul>
<h2 class="no-ref no-num heading settled heading" id=conformance><span class=content>
Conformance</span><a class=self-link href=#conformance></a></h2>
<h3 class="no-ref heading settled heading" id=conventions><span class=content>
Document conventions</span><a class=self-link href=#conventions></a></h3>
<p>Conformance requirements are expressed with a combination of
descriptive assertions and RFC 2119 terminology. The key words "MUST",
"MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this
document are to be interpreted as described in RFC 2119.
However, for readability, these words do not appear in all uppercase
letters in this specification.
<p>All of the text of this specification is normative except sections
explicitly marked as non-normative, examples, and notes. <a data-biblio-type=normative data-link-type=biblio href=#rfc2119 title=rfc2119>[RFC2119]</a></p>
<p>Examples in this specification are introduced with the words "for example"
or are set apart from the normative text with <code>class="example"</code>,
like this:
<div class=example>
<p>This is an example of an informative example.</p>
</div>
<p>Informative notes begin with the word "Note" and are set apart from the
normative text with <code>class="note"</code>, like this:
<p class=note>Note, this is an informative note.</p>
<h3 class="no-ref heading settled heading" id=conformance-classes><span class=content>
Conformance classes</span><a class=self-link href=#conformance-classes></a></h3>
<p>Conformance to this specification
is defined for three conformance classes:
<dl>
<dt>style sheet
<dd>A <a href=http://www.w3.org/TR/CSS21/conform.html#style-sheet>CSS
style sheet</a>.
<dt>renderer
<dd>A <a href=http://www.w3.org/TR/CSS21/conform.html#user-agent>UA</a>
that interprets the semantics of a style sheet and renders
documents that use them.
<dt>authoring tool
<dd>A <a href=http://www.w3.org/TR/CSS21/conform.html#user-agent>UA</a>
that writes a style sheet.
</dl>
<p>A style sheet is conformant to this specification
if all of its statements that use syntax defined in this module are valid
according to the generic CSS grammar and the individual grammars of each
feature defined in this module.
<p>A renderer is conformant to this specification
if, in addition to interpreting the style sheet as defined by the
appropriate specifications, it supports all the features defined
by this specification by parsing them correctly
and rendering the document accordingly. However, the inability of a
UA to correctly render a document due to limitations of the device
does not make the UA non-conformant. (For example, a UA is not
required to render color on a monochrome monitor.)
<p>An authoring tool is conformant to this specification
if it writes style sheets that are syntactically correct according to the
generic CSS grammar and the individual grammars of each feature in
this module, and meet all other conformance requirements of style sheets
as described in this module.
<h3 class="no-ref heading settled heading" id=partial><span class=content>
Partial implementations</span><a class=self-link href=#partial></a></h3>
<p>So that authors can exploit the forward-compatible parsing rules to
assign fallback values, CSS renderers <strong>must</strong>
treat as invalid (and <a href=http://www.w3.org/TR/CSS21/conform.html#ignore>ignore
as appropriate</a>) any at-rules, properties, property values, keywords,
and other syntactic constructs for which they have no usable level of
support. In particular, user agents <strong>must not</strong> selectively
ignore unsupported component values and honor supported values in a single
multi-value property declaration: if any value is considered invalid