-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathOverview.html
More file actions
1489 lines (1141 loc) · 51.8 KB
/
Overview.html
File metadata and controls
1489 lines (1141 loc) · 51.8 KB
<
10000
/div>Open symbols panel
Edit and raw actions
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 PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head
profile="http://dublincore.org/documents/2008/08/04/dc-html/ http://www.w3.org/2006/03/hcard">
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<title>CSS Shapes Module Level 1</title>
<link href="http://purl.org/dc/terms/" rel=schema.dcterms>
<link href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=dcterms.rights>
<meta content="CSS Shapes Module Level 1" name=dcterms.title>
<meta content=text name=dcterms.type>
<meta content=2013-10-03 name=dcterms.date>
<meta content="Vincent Hardy" name=dcterms.creator>
<meta content="Rossen Atanassov" name=dcterms.creator>
<meta content="Alan Stearns" name=dcterms.creator>
<meta content=W3C name=dcterms.publisher>
<meta content="http://dev.w3.org/csswg/css-shapes/"
name=dcterms.identifier>
<script defer=defer
src="http://test.csswg.org/harness/annotate.js#css-shapes-1_dev"
type="text/javascript"></script>
<link href="../shared/style/default.css" rel=stylesheet type="text/css">
<style type="text/css">
.singleImgExample {
display: block;
margin: auto;
}
.example-table {
table-layout: fixed;
width: 100%;
}
.example-table tr td img {
width: 90%;
}
</style>
<link href=issues.css rel=stylesheet type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<link href="../shared/style/alternate-spec-style.css" id=st rel=stylesheet
title="alternate spec style" type="text/css">
<body>
<div class=head id=div-head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1 id=css-shapes-module>CSS Shapes Module Level 1</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 3 October 2013</h2>
<dl>
<dt>This version:
<dd><a
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>Previous version:
<dd>None
<dt>Editors:
<dd class=vcard><span class=fn>Vincent Hardy</span>, <span
class=org>Adobe Systems, Inc.</span>, <span
class=email>vhardy@adobe.com</span>
<dd class=vcard><span class=fn>Rossen Atanassov</span>, <span
class=org>Microsoft Corporation</span>, <span
class=email>ratan@microsoft.com</span>
<dd class=vcard><span class=fn>Alan Stearns</span>, <span class=org>Adobe
Systems, Inc.</span>, <span class=email>stearns@adobe.com</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>
<dt>Feedback:
<dd><a
href="mailto:www-style@w3.org?subject=%5B[css-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-shapes/nightly-unstable/">http://test.csswg.org/suites/css3-regions/nightly-unstable/</a>
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>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>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<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 wrap around the circle shape instead of the float's
bounding box.
<p class=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 href="#CSS-MASKING"
rel=biblioentry>[CSS-MASKING]<!--{{CSS-MASKING}}--></a> and CSS Exclusions
<a href="#CSS3-EXCLUSIONS"
rel=biblioentry>[CSS3-EXCLUSIONS]<!--{{CSS3-EXCLUSIONS}}--></a>.
<h2 class="no-num no-toc" id=status>Status of this document</h2>
<!--begin-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>.</p>
<!--end-status-->
<p>A previous version of this draft has been published as part of the
Working Draft <a
href="http://www.w3.org/TR/2012/WD-css3-exclusions-20120503/">“<cite>CSS
Exclusions and Shapes</cite>” dated 3 May 2012.</a>
<h2 class="no-num no-toc" id=contents>Table of contents</h2>
<!--begin-toc-->
<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-syntax"><span class=secno>3.2. </span>Syntax
of Basic Shapes</a>
<li><a href="#basic-shape-interpolation"><span class=secno>3.3.
</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
‘<code class=property>shape-outside</code>’ Property</a>
<li><a href="#shape-image-threshold-property"><span class=secno>5.2.
</span>The ‘<code class=property>shape-image-threshold</code>’
Property</a>
<li><a href="#shape-margin-property"><span class=secno>5.3. </span>The
‘<code class=property>shape-margin</code>’ property</a>
</ul>
<li><a href="#conformance"><span class=secno>6. </span>Conformance</a>
<li class=no-num><a href="#acknowledgments">Acknowledgments</a>
<li class=no-num><a href="#references">References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references">Normative
references</a>
<li class=no-num><a href="#other-references">Other references</a>
</ul>
<li class=no-num><a href="#index">Index</a>
<li class=no-num><a href="#property-index">Property index</a>
<li class=no-num><a href="#change-log">Change Log</a>
<ul class=toc>
<li class=no-num><a href="#since-june-20th-2013">Since June 20th
2013</a>
<li class=no-num><a href="#since-may-3rd-2012">Since May 3rd 2012</a>
<li class=no-num><a href="#since-december-13th-2011">Since December 13th
2011</a>
</ul>
</ul>
<!--end-toc-->
<h2 id=intro><span class=secno>1. </span>Introduction</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 href="#float-area">float area</a>. The ‘<a
href="#shape-outside"><code class=property>shape-outside</code></a>’
property uses shape values to define the <a href="#float-area">float
area</a> for a float.
<p class=note> If a user agent implements both CSS Shapes and CSS
Exclusions, the ‘<a href="#shape-outside"><code
class=property>shape-outside</code></a>’ property defines the exclusion
area for an exclusion.
<p class=note> A future level of CSS Shapes will define a shape-inside
property, which will define a shape to wrap content within the element.
<h3 id=module-interactions><span class=secno>1.1. </span>Module
Interactions</h3>
<p>This module extends the float features defined in <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> chapter 9.
<h3 id=values><span class=secno>1.2. </span>Values</h3>
<p>This specification follows the CSS property definition conventions from
<a href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a>. Value types
not defined in these specifications are defined in CSS Values and Units
Module Level 3 <a href="#CSS3VAL"
rel=biblioentry>[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 id=terminology><span class=secno>1.3. </span>Terminology</h3>
<p><dfn id=wrap>Wrap</dfn>
<p> This specification uses the term ‘<a href="#wrap"><code
class=property>wrap</code></a>’ to refer to flowing content around the
sides of a float area, defined in <a href="#CSS21"
rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> chapter 9. Content wraps
around the right side of a left-floated box, and content wraps around the
left side of a right-floated box. One result of this wrapping is that line
boxes next to a float are shortened as necessary to avoid intersections
with the float area.
<p><dfn id=float-area>Float area</dfn>
<p> The area used for wrapping content around a float element. The rules
for float behavior use the sides of the float area to determine where
content flows. By default, the float area is the float element's <a
href="http://www.w3.org/TR/CSS2/box.html#box-dimensions">margin box</a>.
This specification's ‘<a href="#shape-outside"><code
class=property>shape-outside</code></a>’ property can be used to define
arbitrary, non-rectangular float areas.
<h2 id=relation-to-box-model-and-float-behavior><span class=secno>2.
</span>Relation to the box model and float behavior</h2>
<p> While the boundaries used for wrapping 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 href="#CSS3BOX"
rel=biblioentry>[CSS3BOX]<!--{{!CSS3BOX}}--></a> module. Also, float
positioning and stacking are not affected by defining a float area with a
shape.
<p> When a shape is used to define a <a href="#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 href="#float-area">float area</a>, not increase
it. A reduced float area may have no effect on some line boxes that would
normally be affected by the float.
<p>A float area defined by a shape may reduce the normal float area on all
sides, but this does not allow content to wrap on both sides of a float.
Left floats with a ‘<a href="#shape-outside"><code
class=property>shape-outside</code></a>’ still only allow content
wrapping on the right side, and right floats only allow wrapping 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
href="#shape-outside"><code class=property>shape-outside</code></a>’
property.
<pre><code class=html>
<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>
</div></code></pre>
<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.
<p>
<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 href="#float-area">float
area</a> with no extent. Because wrapping only considers the float area,
the shape below applied to a left float will allow inline content to flow
through all of the float's box.
<p>
<pre><code class=css>
shape-outside: rectangle(0,0,0%,0%);
</code></pre>
</div>
<div class=example>
<p> A ‘<a href="#shape-outside"><code
class=property>shape-outside</code></a>’ can create open areas on both
the left and right of a float area. Content still wraps 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 class=css>
shape-outside: polygon(50px 0px, 100px 100px, 0px 100px);
</code></pre>
<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
wraps around the shape, and otherwise overlays the rest of the float
margin box.
<pre><code class=html>
.float-left {
shape-outside: polygon(0% 50%, 50% 100%, 0 100%);
float: left;
width: 100px;
height: 100px;
margin-top: 20px;
}
</code></pre>
<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 float area.</p>
<img alt="Stacking two floats with a small shape-outside"
class=singleImgExample src="images/stacked-float-example.png"></div>
<h2 id=basic-shapes-from-svg-syntax><span class=secno>3. </span>Basic
Shapes</h2>
<p> Shapes can be specified using types and parameters drawn from SVG's <a
href="http://www.w3.org/TR/SVG/shapes.html">basic shapes</a>. The
definitions use the <code><a
href="http://www.w3.org/TR/css3-values/#lengths"><length></a></code>
and <code><a
href="http://www.w3.org/TR/css3-values/#percentages"><percentage></a></code>
types. When using this syntax to define shapes, the relevant box is
determined by the computed value of the <a
href="http://www.w3.org/TR/css3-ui/#box-sizing">‘<code
class=property>box-sizing</code>’</a> property. The coordinate system
for the shape has its origin on the top-left corner of the relevant box
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 relevant box. For the radius <code>r</code> of the <a
href="#circle"><code>circle</code></a> shape, a percentage value is
resolved from the used width and height of the relevant box as
<code>sqrt((<em>width</em>)**2 + (<em>height</em>)**2))/sqrt(2)</code>.
<h3 id=supported-basic-shapes><span class=secno>3.1. </span>Supported
Shapes</h3>
<p>The following basic shapes are supported. All basic shapes use
functional notation following the rules defined in <a
href="http://www.w3.org/TR/css3-values/#functional-notation">CSS Values
and Units</a> <a href="#CSS3VAL"
rel=biblioentry>[CSS3VAL]<!--{{CSS3VAL}}--></a>.
<dl>
<dt><dfn id=rectangle>rectangle</dfn>() takes four to six arguments of
<length> or <percentage>
<dd>
<ul>
<li> The first four arguments represent <strong>x, y, width</strong> and
<strong>height</strong> of the rectangle. Negative values for width and
height are invalid.
<li> The last two optional arguments represent <strong> rx</strong> and
<strong>ry</strong>. For rounded rectangles they define the x-axis
radius and y-axis radius of the ellipse used to round off the corners
of the rectangle. Negative values for rx and ry are invalid. See notes
below on edge cases for these arguments.
</ul>
<dt><dfn id=inset-rectangle>inset-rectangle</dfn>() takes four to six
arguments of <length> or <percentage>
<dd>
<ul>
<li> The first four arguments represent the <strong>top, right,
bottom</strong> and <strong>left</strong> offsets from the relevant box
inward that define the positions of the edges of the inset rectangle.
Negative values for any of these insets are invalid.
<li> The last two optional arguments represent <strong> rx</strong> and
<strong>ry</strong>. For rounded inset rectangles they define the
x-axis radius and y-axis radius of the ellipse used to round off the
corners of the inset rectangle. Negative values for rx and ry are
invalid. See notes below on edge cases for these arguments.
</ul>
<dt><dfn id=circle>circle</dfn>() takes three arguments of <length>
or <percentage>
<dd>
<ul>
<li> The three arguments represent <strong>cx</strong>,
<strong>cy</strong>, and <strong>r</strong>. They define the x-axis and
y-axis coordinates of the center of the circle and the radius of the
circle. A negative value for r is invalid.
</ul>
<dt><dfn id=ellipse>ellipse</dfn>() takes four arguments of <length>
or <percentage>
<dd>
<ul>
<li> The four arguments represent <strong>cx</strong>,
<strong>cy</strong>, <strong>rx</strong>, and <strong>ry</strong>. They
define the x-axis and y-axis coordinates of the center of the ellipse
and the x-axis and y-axis radius of the ellipse. Negative values for rx
and ry are invalid.
</ul>
<dt><dfn id=polygon>polygon</dfn>() starts with an optional
<fill-rule> argument, followed by a list of arguments consisting of
<length> or <percentage> pairs.
<dd>
<ul>
<li><strong>fill-rule</strong> - 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 nonzero or evenodd.
Default value when omitted is nonzero.
<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.
</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 float area, which allows inline content to flow
through all of the float's box.
</dl>
<p>If either or both of the values for corner radii on rectangle or
inset-rectangle are omitted, then their values are determined in the
following manner. If neither rx nor ry are specified, the values are 0 for
both. If only one value is specified, that value is used for both.
<p>If the values for corner radii cause any of the curves to overlap, the
solution for <a
href="http://www.w3.org/TR/css3-background/#corner-overlap">overlapping
curves</a> from CSS Backgrounds and Borders <a href="#CSS3BG"
rel=biblioentry>[CSS3BG]<!--{{!CSS3BG}}--></a> is used to avoid the
overlap.
<p>
<h3 id=basic-shape-syntax><span class=secno>3.2. </span>Syntax of Basic
Shapes</h3>
<pre>
rectangle() =
rectangle( <shape-arg>, <shape-arg>, <shape-arg>, <shape-arg> [, <shape-arg>]? [, <shape-arg>]? )
inset-rectangle() =
inset-rectangle( <shape-arg>, <shape-arg>, <shape-arg>, <shape-arg> [, <shape-arg>]? [, <shape-arg>]? )
circle() = circle( <shape-arg>, <shape-arg>, <shape-arg> )
ellipse() = ellipse( <shape-arg>, <shape-arg>, <shape-arg>, <shape-arg> )
polygon() = polygon( [<fill-rule>,]? [<shape-arg>]{2}# )
<shape-arg> = <length> | <percentage>
<fill-rule> = nonzero | evenodd
</pre>
<h3 id=basic-shape-interpolation><span class=secno>3.3.
</span>Interpolation of Basic Shapes</h3>
<p>For interpolating between one basic shape and a second, the rules
described below are applied.
<ul>
<li>If both basic shapes are of the same type and not of type polygon:
<ul>
<li>Interpolate between each value.
</ul>
<li>If one basic shape is of type rectangle and the second of type circle
or ellipse:
<ul>
<li>Replace the circle/ellipse with a temporary rectangle of equal
dimension.
<li>Set the values for rx and ry on the temporary rectangle to
‘50%’.
<li>Interpolate between the two rectangles as above.
</ul>
<li>If one basic shape is an inset-rectangle and the second is of type
rectangle, circle or ellipse:
<ul>
<li>Replace the inset-rectangle with a temporary rectangle of equal
dimension.
<li>Interpolate between the basic shapes as above.
</ul>
<li>If both basic shapes are of type polygon and if both polygons have the
same number of vertices:
<ul>
<li>Interpolate between each value.
</ul>
<li>In all other cases:
<ul>
<li>No interpolation is specified.
</ul>
</ul>
<h2 id=shapes-from-image><span class=secno>4. </span>Shapes from Image</h2>
<p> Another way of defining shapes is by specifying a source image 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 href="#shape-image-threshold"><code
class=property>shape-image-threshold</code></a>’ value. If the ‘<a
href="#shape-image-threshold"><code
class=property>shape-image-threshold</code></a>’ is not specified, the
initial value to be considered is 0.0.
<p>Sizing the shape from an image follows the <a
href="http://www.w3.org/TR/2012/CR-css3-images-20120417/#concrete-size-resolution">Concrete
Object Size Resolution</a> section from <a href="#CSS3-IMAGES"
rel=biblioentry>[CSS3-IMAGES]<!--{{!CSS3-IMAGES}}--></a>.
<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. <!--
For <a href="http://www.w3.org/TR/2002/WD-SVG2Reqs-20020422/">SVG</a>
images ([[SVG11]]),
the image is rendered without animations applied.-->
<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 href="#float-area">float area</a> through the
‘<a href="#shape-outside"><code
class=property>shape-outside</code></a>’ property.
<pre><code class=html>
<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 href="#shape-outside"><code
class=property>shape-outside</code></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 href="#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>Changing the value of the ‘<a href="#shape-image-threshold"><code
class=property>shape-image-threshold</code></a>’ property
<li>Changing the value of the ‘<a href="#shape-margin"><code
class=property>shape-margin</code></a>’ property (see example 8)
</ol>
<div class=figure> <img
alt="A float shape around an image using its alpha-channel"
src="images/shape-outside-image.png" width="70%">
<p class=caption>A float shape around an image using its alpha-channel.
</div>
</div>
<!-- End section "Shapes from image" -->
<h2 id=declaring-shapes><span class=secno>5. </span>Declaring Shapes</h2>
<p> Shapes are declared with the ‘<a href="#shape-outside"><code
class=property>shape-outside</code></a>’ property, with possible
modifications from the ‘<a href="#shape-margin"><code
class=property>shape-margin</code></a>’ property. The shape defined by
the ‘<a href="#shape-outside"><code
class=property>shape-outside</code></a>’ and ‘<a
href="#shape-margin"><code class=property>shape-margin</code></a>’
properties changes the geometry of a float element's <a
href="#float-area">float area</a>.
<h3 id=shape-outside-property><span class=secno>5.1. </span>The ‘<a
href="#shape-outside"><code class=property>shape-outside</code></a>’
Property</h3>
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=shape-outside title=shape-outside>shape-outside</dfn>
<tr>
<th>Value:
<td><var>auto</var> | <var><basic-shape></var> |
<var><image></var>
<tr>
<th>Initial:
<td>auto
<tr>
<th>Applies to:
<td>floats
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>computed lengths for <basic-shape>, the image with its URI
made absolute, otherwise as specified
</table>
<p>The values of this property have the following meanings:
<dl>
<dt><dfn id=auto title="shape-outside!!auto">auto</dfn>
<dd>The <a href="#float-area">float area</a> uses the margin box as
normal.
</dl>
<dl>
<dt><dfn id=ltbasic-shapegt
title="shape-outside!!<basic-shape>"><basic-shape></dfn>
<dd> The shape is computed based on the values of one of ‘<a
href="#rectangle"><code class=property>rectangle</code></a>’, ‘<a
href="#inset-rectangle"><code
class=property>inset-rectangle</code></a>’, ‘<a href="#circle"><code
class=property>circle</code></a>’, ‘<a href="#ellipse"><code
class=property>ellipse</code></a>’ or ‘<a href="#polygon"><code
class=property>polygon</code></a>’.
</dl>
<dl>
<dt><dfn id=ltimagegt
title="shape-outside!!<image>"><image></dfn>
<dd>
<p> The shape is extracted and computed based on the alpha channel of the
specified <a
href="http://dev.w3.org/csswg/css-values/#images"><image></a> as
defined by ‘<a href="#shape-image-threshold"><code
class=property>shape-image-threshold</code></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 href="#HTML5"
rel=biblioentry>[HTML5]<!--{{!HTML5}}--></a> specification for all URLs
in a ‘<a href="#shape-outside"><code
class=property>shape-outside</code></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 ‘<code
class=property>auto</code>’ had been specified.
</dl>
<!-- End section "The shape-outside Property" -->
<h3 id=shape-image-threshold-property><span class=secno>5.2. </span>The
‘<a href="#shape-image-threshold"><code
class=property>shape-image-threshold</code></a>’ Property</h3>
<p> The ‘<a href="#shape-image-threshold"><code
class=property>shape-image-threshold</code></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=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=shape-image-threshold
title=shape-image-threshold>shape-image-threshold</dfn>
<tr>
<th>Value:
<td><var><number></var>
<tr>
<th>Initial:
<td>0.0
<tr>
<th>Applies to:
<td>floats
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>alpha channel of the image specified by ‘<a
href="#shape-outside"><code class=property>shape-outside</code></a>’
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>The same as the specified value after clipping the <number> to
the range [0.0,1.0].
</table>
<p>The values of this property have the following meanings:
<dl>
<dt><dfn id=ltnumbergt
title="shape-image-threshold!!<number>"><number></dfn>
<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.
</dl>
<div class=note>
<p>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.
</div>
<!-- End section "The shape-image-threshold property" -->
<!-- End section "Declaring Shapes" -->
<h3 id=shape-margin-property><span class=secno>5.3. </span>The ‘<a
href="#shape-margin"><code class=property>shape-margin</code></a>’
property</h3>
<p> The ‘<a href="#shape-margin"><code
class=property>shape-margin</code></a>’ property adds a margin to a
‘<a href="#shape-outside"><code
class=property>shape-outside</code></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 href="#shape-margin"><code
class=property>shape-margin</code></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
href="#shape-margin"><code class=property>shape-margin</code></a>’. This
property takes only non-negative values.
<table class=propdef>
<tbody>
<tr>
<th>Name:
<td><dfn id=shape-margin title=shape-margin>shape-margin</dfn>
<tr>
<th>Value:
<td><var><length></var>
<tr>
<th>Initial:
<td>0
<tr>
<th>Applies to:
<td>floats
<tr>
<th>Inherited:
<td>no
<tr>
<th>Percentages:
<td>N/A
<tr>
<th>Media:
<td>visual
<tr>
<th>Computed value:
<td>the absolute length
</table>
<div class=example>
<p>A ‘<a href="#shape-margin"><code
class=property>shape-margin</code></a>’ creating an offset from a
polygonal ‘<a href="#shape-outside"><code
class=property>shape-outside</code></a>’. The lighter blue area shows
the shape in a 100x100px float, and the darker blue area shows the 10px
offset.
<pre><code class=html>
.float {
shape-outside: polygon(10px 10px, 90px 50px, 40px 50px, 90px 90px, 10px 90px);
shape-margin: 10px;
}
</code></pre>
<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
wrapping around the shape are shortened further.
<pre><code class=html>
#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" width="70%">
<p class=caption>A float shape around an image using its alpha-channel
with a 35 pixels ‘<a href="#shape-margin"><code
class=property>shape-margin</code></a>’
</div>
</div>
<!-- End secion "shape-margin property" -->
<!-- End section "Shapes" -->