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
1322 lines (1009 loc) · 44.6 KB
/
Overview.html
File metadata and controls
1322 lines (1009 loc) · 44.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html 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-07-19 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 19 July 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:</dt>
<dd><a href="http://test.csswg.org/suites/css3-shapes/nightly-unstable/">http://test.csswg.org/suites/css3-regions/nightly-unstable/</a></dd>
</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 control the geometric shapes used for wrapping inline flow
content outside an element. For Level 1, CSS Shapes can be applied to
floats. A circle shape on a float will cause inline content to wra
93CD
p 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
<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>
<li><a href="#definitions"><span class=secno>2. </span>Definitions</a>
<li><a href="#shapes"><span class=secno>3. </span>Shapes</a>
<ul class=toc>
<li><a href="#relation-to-box-model-and-float-behavior"><span
class=secno>3.1. </span>Relation to the box model and float
behavior</a>
<li><a href="#basic-shapes-from-svg-syntax"><span class=secno>3.2.
</span>Basic Shapes</a>
<ul class=toc>
<li><a href="#supported-basic-shapes"><span class=secno>3.2.1.
</span>Supported Shapes</a>
<li><a href="#basic-shape-interpolation"><span class=secno>3.2.2.
</span>Interpolation of Basic Shapes</a>
</ul>
<li><a href="#shapes-from-image"><span class=secno>3.3. </span>Shapes
from Image</a>
<li><a href="#declaring-shapes"><span class=secno>3.4. </span>Declaring
Shapes</a>
<ul class=toc>
<li><a href="#shape-outside-property"><span class=secno>3.4.1.
</span>The ‘<code class=property>shape-outside</code>’
Property</a>
<li><a href="#shape-image-threshold-property"><span class=secno>3.4.2.
</span>The ‘<code class=property>shape-image-threshold</code>’
Property</a>
<li><a href="#shape-margin-property"><span class=secno>3.4.3.
</span>The ‘<code class=property>shape-margin</code>’
property</a>
</ul>
</ul>
<li><a href="#conformance"><span class=secno>4. </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> This specification defines properties to control the geometry of an
element's <a href="#float-area">float area</a>.
<h2 id=definitions><span class=secno>2. </span>Definitions</h2>
<p><dfn id=float-area>Float area</dfn>
<p> The area used for wrapping content around a float element. 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=shapes><span class=secno>3. </span>Shapes</h2>
<p> Shapes define arbitrary geometric contours around which inline content
flows. The shape-outside property defines 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 shape-outside 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=relation-to-box-model-and-float-behavior><span class=secno>3.1.
</span>Relation to the box model and float behavior</h3>
<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.
<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. When a shape reduces a <a href="#float-area">float area</a> such that
a line box that would be normally be affected by the float would not
intersect the <a href="#float-area">float area</a> at all, the available
space for the line box is constrained by the farthest margin edge of the
float. For a left float this would be the left margin edge, and for a
right float this would be the right margin edge.
<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. The shape below applied to a left float will
allow inline content to flow through the float's box, but the line boxes
will be constrained by the float's left margin edge.
<p>
<pre><code class=css>
shape-outside: rectangle(0,0,0%,0%);
</code></pre>
</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 in mauve, and the margin area
in yellow. The inline content only wraps around the shape.
<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.</p>
<img alt="Stacking two floats to show far margin edge constraint"
class=singleImgExample src="images/stacked-float-example.png"></div>
<h3 id=basic-shapes-from-svg-syntax><span class=secno>3.2. </span>Basic
Shapes&l
93CD
t;/h3>
<p> Shapes can be specified using syntax similar to SVG's <a
href="http://www.w3.org/TR/SVG/shapes.html">basic shapes</a>. The
definitions use <code><a
href="http://www.w3.org/TR/css3-values/#lengths"><length></a></code>
type and the <code><a
href="http://www.w3.org/TR/css3-values/#percentages"><percentage></a></code>
types <a href="#CSS3VAL" rel=biblioentry>[CSS3VAL]<!--{{!CSS3VAL}}--></a>.
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 as <a
href="http://www.w3.org/TR/SVG/coords.html#Units">specified</a> in the SVG
recommendation <a href="#SVG11"
rel=biblioentry>[SVG11]<!--{{!SVG11}}--></a>.
<h4 id=supported-basic-shapes><span class=secno>3.2.1. </span>Supported
Shapes</h4>
<p>The following basic shapes are supported.
<dl>
<dt><dfn
id=rectangle>rectangle</dfn>([<length>|<percentage>][,
[<length>|<percentage>]]{3,5})
<dd>
<ul>
<li> The first four values represent <strong>x, y, width</strong> and
<strong>height</strong>. They define the bounding box of the rectangle.
Negative values for width and height are invalid.
<li> The last two optional values 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 values.
</ul>
<dt><dfn
id=inset-rectangle>inset-rectangle</dfn>([<length>|<percentage>][,
[<length>|<percentage>]]{3,5})
<dd>
<ul>
<li> The first four values represent the <strong>top, right,
bottom</strong> and <strong>left</strong> insets that define the
bounding box of the inset rectangle. Negative values for any of these
insets are invalid.
<li> The last two optional values 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 values.
</ul>
<dt><dfn id=circle>circle</dfn>([<length>|<percentage>][,
[<length>|<percentage>]]{2})
<dd>
<ul>
<li> The three values values 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>([<length>|<percentage>][,
[<length>|<percentage>]]{3})
<dd>
<ul>
<li> The four values 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>([<fill-rule>,]?[<length>|<percentage>]{2}#)
<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> The two length values represent <strong>xi</strong> and
<strong>yi</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>
<br>
</dl>
<p>The values for corner radii on rectangle or inset-rectangle are
determined implicitly if either the rx or ry values are not specified, or
are specified but with invalid values. If neither rx nor ry are properly
specified, the values are 0 for both. If only one value is properly
specified, that value is used for both. And if the values 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>
<h4 id=basic-shape-interpolation><span class=secno>3.2.2.
</span>Interpolation of Basic Shapes</h4>
<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>
<h3 id=shapes-from-image><span class=secno>3.3. </span>Shapes from Image</h3>
<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>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 and specifies a value
of 35 pixels for the ‘<a href="#shape-margin"><code
class=property>shape-margin</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: url("CSS-logo1s.png");
shape-image-threshold: 0.1;
shape-margin: 35px;
}
</style></code></pre>
<p>The image needs two references to the image because this example uses
the same image
<ol>
<li>to render it
<li>as a shape defining the <a href="#float-area">float area</a> of the
image
</ol>
<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 and the 35px shape-margin is visible
between that line and the edges of each individual line of the paragraph.
<p>It's then possible to affect where the lines of the paragraph start in
three ways:
<ol>
<li>Changing the value of the ‘<a href="#shape-margin"><code
class=property>shape-margin</code></a>’ property
<li>Changing the value of the ‘<a href="#shape-image-threshold"><code
class=property>shape-image-threshold</code></a>’ property
<li>Modifying the alpha channel in the image
</ol>
<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.png" width="70%">
<p class=caption>A float shape around an image using its alpha-channel
with a 35 pixels shape-margin
</div>
</div>
<!-- End section "Shapes from image" -->
<h3 id=declaring-shapes><span class=secno>3.4. </span>Declaring Shapes</h3>
<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>.
<h4 id=shape-outside-property><span class=secno>3.4.1. </span>The ‘<a
href="#shape-outside"><code class=property>shape-outside</code></a>’
Property</h4>
<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'!!'<uri>'"><image></dfn>
<dd> 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> <a
href="#CSS3VAL" rel=biblioentry>[CSS3VAL]<!--{{!CSS3VAL}}--></a> 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 shape-outside 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" -->
<h4 id=shape-image-threshold-property><span class=secno>3.4.2. </span>The
‘<a href="#shape-image-threshold"><code
class=property>shape-image-threshold</code></a>’ Property</h4>
<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><alphavalue></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">shape-outside</a>
<tr>
<th>Media:
<td>visual
<tr>
<th>Com
CDD
puted value:
<td>The same as the specified value after clipping the
<alphavalue> to the range [0.0,1.0].
</table>
<p>The values of this property have the following meanings:
<dl>
<dt><dfn id=ltalphavaluegt
title="'shape-image-threshold'!!'<alphavalue>'"><alphavalue></dfn>
<dd> A <number> value used to set the threshold used for extracting
a shape from an image. Any values outside the range 0.0 (fully
transparent) to 1.0 (fully opaque) will be clamped to this range.
</dl>
<!-- End section "The shape-image-threshold property" -->
<!-- End section "Declaring Shapes" -->
<h4 id=shape-margin-property><span class=secno>3.4.3. </span>The ‘<a
href="#shape-margin"><code class=property>shape-margin</code></a>’
property</h4>
<p> The ‘<a href="#shape-margin"><code
class=property>shape-margin</code></a>’ property adds a margin to a
shape-outside. This defines a new shape where every point is the specified
distance from the shape-outside. This property takes on positive values
only.
<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
circlular shape-outside. The blue rectangles represent inline content
affected by the shape created by the margin.</p>
<img alt="Example of a shape-margin offset" src="images/shape-margin.png"></div>
<!-- End secion "shape-margin property" -->
<!-- End section "Shapes" -->
<h2 id=conformance><span class=secno>4. </span>Conformance</h2>
<!--begin-conformance-->
<h3 class=no-ref id=conventions> Document conventions</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
href="#RFC2119" rel=biblioentry>[RFC2119]<!--{{!RFC2119}}--></a>
<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.
</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.
<h3 class=no-ref id=conformance-classes> Conformance classes</h3>
<p>Conformance to this specification is defined for three conformance
classes:
<dl>
<dt><dfn id=style-sheet title="style sheet!!as conformance class">style
sheet</dfn>
<dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
style sheet</a>.
<dt><dfn id=renderer>renderer</dfn>
<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><dfn id=authoring-tool>authoring tool</dfn>
<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 id=partial> Partial implementations</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 (as
unsupported values must be), CSS requires that the entire declaration be
ignored.
<h3 class=no-ref id=experimental> Experimental implementations</h3>
<p>To avoid clashes with future CSS features, the CSS 2.1 specification
reserves a <a
href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
syntax</a> for proprietary and experimental extensions to CSS.
<p>Prior to a specification reaching the Candidate Recommendation stage in
the W3C process, all implementations of a CSS feature are considered
experimental. The CSS Working Group recommends that implementations use a
vendor-prefixed syntax for such features, including those in W3C Working
Drafts. This avoids incompatibilities with future changes in the draft.
<h3 class=no-ref id=testing> Non-experimental implementations</h3>
<p>Once a specification reaches the Candidate Recommendation stage,
non-experimental implementations are possible, and implementors should
release an unprefixed implementation of any CR-level feature they can
demonstrate to be correctly implemented according to spec.
<p>To establish and maintain the interoperability of CSS across
implementations, the CSS Working Group requests that non-experimental CSS
renderers submit an implementation report (and, if necessary, the
testcases used for that implementation report) to the W3C before releasing
an unprefixed implementation of any CSS features. Testcases submitted to
W3C are subject to review and correction by the CSS Working Group.
<p>Further information on submitting testcases and implementation reports
can be found from on the CSS Working Group's website at <a
href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
Questions should be directed to the <a
href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
mailing list. <!--end-conformance-->
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>
<p>This specification is made possible by input from Andrei Bucur,
Alexandru Chiculita, 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 id=references>References</h2>