-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
executable file
·2219 lines (1807 loc) · 204 KB
/
Overview.html
File metadata and controls
executable file
·2219 lines (1807 loc) · 204 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 Transforms Module Level 1</title>
<link href=../default.css rel=stylesheet type=text/css>
<link href=../csslogo.ico rel="shortcut icon" type=image/x-icon>
<link href=https://www.w3.org/StyleSheets/TR/W3C-ED rel=stylesheet type=text/css>
<script defer src=http://test.csswg.org/harness/annotate.js#css-transforms-1_dev type=text/javascript></script>
</head>
<body class=h-entry>
<style scoped type=text/css>
.example {
clear:both
}
th {
text-align:left
}
.pseudo-code {
font-family:monospace
}
.pseudo-code > ol {
list-style-type:decimal
}
.pseudo-code > ol > li > ol {
list-style-type:lower-latin
}
.pseudo-code > ol > li > ol > li > ol {
list-style-type:lower-roman
}
.pseudo-code ul {
list-style-type:disc
}
dd > p:nth-child(1) {
margin-top:0
}
</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 Transforms 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=20131114>14 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-transforms/>http://dev.w3.org/csswg/css-transforms/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css3-transforms/>http://www.w3.org/TR/css3-transforms/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-transforms/>http://dev.w3.org/csswg/css-transforms/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2012/WD-css3-transforms-20120911/ rel=previous>http://www.w3.org/TR/2012/WD-css3-transforms-20120911/</a><dd><a href=http://www.w3.org/TR/2012/WD-css3-transforms-20120403/ rel=previous>http://www.w3.org/TR/2012/WD-css3-transforms-20120403/</a>
<dt>Feedback:</dt>
<dd><a href="mailto:public-fx@w3.org?subject=%5Bcss-transforms%5D%20feedback">public-fx@w3.org</a>
with subject line
“<kbd>[css-transforms] <var>… message topic …</var></kbd>”(<a href=http://lists.w3.org/Archives/Public/public-fx/ rel=discussion>archives</a>)<dt>Test Suite:<dd><a href=http://test.csswg.org/suites/css3-transforms/nightly-unstable/>http://test.csswg.org/suites/css3-transforms/nightly-unstable/</a><dt>Editors:
<dd class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:simon.fraser@apple.com>Simon Fraser</a> (<span class="p-org org"><a href=http://www.apple.com/>Apple Inc</a></span>)<dd class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:dino@apple.com>Dean Jackson</a> (<span class="p-org org"><a href=http://www.apple.com/>Apple Inc</a></span>)<dd class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:eoconnor@apple.com>Edward O’Connor</a> (<span class="p-org org"><a href=http://www.apple.com/>Apple Inc</a></span>)<dd class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:dschulze@adobe.com>Dirk Schulze</a> (<span class="p-org org"><a href=http://www.adobe.com/>Adobe Systems Inc</a></span>)<dt>Former Editors:
<dd class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:hyatt@apple.com>David Hyatt</a> (<span class="p-org org"><a href=http://www.apple.com/>Apple Inc</a></span>)<dd class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:cmarrin@apple.com>Chris Marrin</a> (<span class="p-org org"><a href=http://www.apple.com/>Apple Inc</a></span>)<dd class="p-author h-card vcard"><a class="p-name fn u-email email" href=mailto:ayg@aryeh.name>Aryeh Gregor</a> (<span class="p-org org"><a href=http://www.mozilla.org/>Mozilla</a></span>)<dt>Issues List:<dd><a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&product=CSS&component=Transforms&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 transforms allows elements styled with CSS to be transformed in two-dimensional or three-dimensional space. This specification is the convergence of the <a href=http://www.w3.org/TR/css3-2d-transforms/>CSS 2D transforms</a>, <a href=http://www.w3.org/TR/css3-3d-transforms/>CSS 3D transforms</a> and <a href=http://www.w3.org/TR/2009/WD-SVG-Transforms-20090320/>SVG transforms</a> specifications.
<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/public-fx/>archived</a>) public mailing list
<a href="mailto:public-fx@w3.org?Subject=%5Bcss-transforms%5D%20PUT%20SUBJECT%20HERE">public-fx@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-transforms” in the subject,
preferably like this:
“[css-transforms] <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>) and the <a href=http://www.w3.org/Graphics/SVG/WG/>SVG Working Group</a> (part of the
<a href=http://www.w3.org/Graphics/>Graphics Activity</a>).
<p>
This document was produced by groups 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 (CSS)</a>
and a <a href=http://www.w3.org/2004/01/pp-impl/19480/status rel=disclosure>public list of any patent disclosures (SVG)</a>
made in connection with the deliverables of each group;
these pages 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><li><a href=#module-interactions><span class=secno>2</span>Module Interactions</a><li><a href=#css-values><span class=secno>3</span>CSS Values</a><li><a href=#terminology><span class=secno>4</span>Terminology</a><li><a href=#two-dimensional-subset><span class=secno>5</span>Two Dimensional Subset</a><li><a href=#transform-rendering><span class=secno>6</span>The Transform Rendering Model</a><ul class=toc><li><a href=#3d-transform-rendering><span class=secno>6.1</span>3D Transform Rendering</a><li><a href=#processing-of-perspective-transformed-boxes><span class=secno>6.2</span>
Processing of Perspective-Transformed Boxes
</a></ul><li><a href=#transform-property><span class=secno>7</span>The <span class=property data-link-type=propdesc title=transform>transform</span> Property</a><li><a href=#transform-origin-property><span class=secno>8</span>The <span class=property data-link-type=propdesc title=transform-origin>transform-origin</span> Property</a><li><a href=#transform-style-property><span class=secno>9</span>The <span class=property data-link-type=propdesc title=transform-style>transform-style</span> Property</a><li><a href=#perspective-property><span class=secno>10</span>The <span class=property data-link-type=propdesc title=perspective>perspective</span> Property</a><li><a href=#perspective-origin-property><span class=secno>11</span>The <span class=property data-link-type=propdesc title=perspective-origin>perspective-origin</span> Property</a><li><a href=#backface-visibility-property><span class=secno>12</span>The <span class=property data-link-type=propdesc title=backface-visibility>backface-visibility</span> Property</a><li><a href=#svg-transform><span class=secno>13</span>The SVG <span class=property data-link-type=propdesc title=transform>transform</span> Attribute</a><ul class=toc><li><a href=#transform-attribute-specificity><span class=secno>13.1</span>
SVG <span class=property data-link-type=propdesc title=transform>transform</span> attribute specificity
</a><li><a href=#svg-syntax><span class=secno>13.2</span>Syntax of the SVG <span class=property data-link-type=propdesc title=transform>transform</span> attribute</a><ul class=toc><li><a href=#svg-transform-list><span class=secno>13.2.1</span>Transform List</a><li><a href=#svg-functional-notation><span class=secno>13.2.2</span>Functional Notation</a><li><a href=#svg-data-types><span class=secno>13.2.3</span>SVG Data Types</a><ul class=toc><li><a href=#svg-transform-value><span class=secno>13.2.3.1</span>
The <span class=production data-link-type=type title="<translation-value>"><translation-value></span> and <span class=production data-link-type=type title="<length>"><length></span> type
</a><li><a href=#svg-angle><span class=secno>13.2.3.2</span>The <span class=production data-link-type=type title="<angle>"><angle></span> type</a><li><a href=#svg-number><span class=secno>13.2.3.3</span>The <span class=production data-link-type=type title="<number>"><number></span> type</a></ul></ul><li><a href=#svg-gradient-transform-pattern-transform><span class=secno>13.3</span>
The SVG <span class=attr-name data-link-type=maybe title=gradienttransform>gradientTransform</span> and <span class=attr-name data-link-type=maybe title=patterntransform>patternTransform</span> attributes
</a><li><a href=#svg-transform-functions><span class=secno>13.4</span>
SVG transform functions
</a><li><a href=#svg-three-dimensional-functions><span class=secno>13.5</span>SVG and 3D transform functions</a><li><a href=#svg-user-coordinate-space><span class=secno>13.6</span>User coordinate space</a><li><a href=#transform-attribute-dom><span class=secno>13.7</span>
SVG DOM interface for the <span class=property data-link-type=propdesc title=transform>transform</span> attribute
</a></ul><li><a href=#svg-animation><span class=secno>14</span>SVG Animation</a><ul class=toc><li><a href=#svg-animate-element><span class=secno>14.1</span>
The <span><code class=element-name><animate></code></span> and <span><code class=element-name><set></code></span> element
</a><li><a href=#neutral-element><span class=secno>14.2</span>Neutral element for addition</a><li><a href=#svg-attribute-name><span class=secno>14.3</span>
The SVG <span class=property data-link-type=propdesc title=attributename>attributeName</span> attribute
</a></ul><li><a href=#transform-functions><span class=secno>15</span>The Transform Functions</a><ul class=toc><li><a href=#two-d-transform-functions><span class=secno>15.1</span>2D Transform Functions</a><li><a href=#three-d-transform-functions><span class=secno>15.2</span>3D Transform Functions</a></ul><li><a href=#transform-function-lists><span class=secno>16</span>The Transform Function Lists</a><li><a href=#interpolation-of-transforms><span class=secno>17</span>Interpolation of Transforms</a><li><a href=#transform-primitives><span class=secno>18</span>
Transform function primitives and derivatives
</a><li><a href=#interpolation-of-transform-functions><span class=secno>19</span>
Interpolation of primitives and derived transform functions
</a><li><a href=#matrix-interpolation><span class=secno>20</span>Interpolation of Matrices</a><ul class=toc><li><a href=#supporting-functions><span class=secno>20.1</span>Supporting functions</a><li><a href=#interpolation-of-2d-matrices><span class=secno>20.2</span>Interpolation of 2D matrices</a><ul class=toc><li><a href=#decomposing-a-2d-matrix><span class=secno>20.2.1</span>Decomposing a 2D matrix</a><li><a href=#interpolation-of-decomposed-2d-matrix-values><span class=secno>20.2.2</span>
Interpolation of decomposed 2D matrix values
</a><li><a href=#recomposing-to-a-2d-matrix><span class=secno>20.2.3</span>Recomposing to a 2D matrix</a></ul><li><a href=#interpolation-of-3d-matrices><span class=secno>20.3</span>Interpolation of 3D matrices</a><ul class=toc><li><a href=#decomposing-a-3d-matrix><span class=secno>20.3.1</span>Decomposing a 3D matrix</a><li><a href=#interpolation-of-decomposed-3d-matrix-values><span class=secno>20.3.2</span>
Interpolation of decomposed 3D matrix values
</a><li><a href=#recomposing-to-a-3d-matrix><span class=secno>20.3.3</span>Recomposing to a 3D matrix</a></ul></ul><li><a href=#mathematical-description><span class=secno>21</span>
Mathematical Description of Transform Functions
</a><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><li><a href=#issues-index><span class=secno></span>Issues 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>The CSS <a href=http://www.w3.org/TR/REC-CSS2/visuren.html>visual formatting model</a> describes a coordinate system within each element is positioned. Positions and sizes in this coordinate space can be thought of as being expressed in pixels, starting in the origin of point with positive values proceeding to the right and down.
<p>This coordinate space can be modified with the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> property. Using transform, elements can be translated, rotated and scaled in two or three dimensional space.
<p>Additional properties make working with transforms easier, and allow the author to control how nested three-dimensional transforms interact.
<p><ul>
<li>
The <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> property provides a convenient way to control the origin about which transforms on an element are applied.
</li>
<li>
The <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> property allows the author to make child elements with three-dimensional transforms appear as if they live in a common three-dimensional space. The <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> property provides control over the origin at which perspective is applied, effectively changing the location of the "vanishing point".
</li>
<li>
The <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a> property allows 3D-transformed elements and their 3D-transformed descendants to share a common three-dimensional space, allowing the construction of hierarchies of three-dimensional objects.
</li>
<li>
The <a class=property data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility</a> property comes into play when an element is flipped around via three-dimensional transforms such that its reverse side is visible to the viewer. In some situations it is desirable to hide the element in this situation, which is possible using the value of <span class=css data-link-type=maybe title=hidden>hidden</span> for this property.
</li>
</ul>
<p class=note>Note: While some values of the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> property allow an element to be transformed in a three-dimensional coordinate system, the elements themselves are not three-dimensional objects. Instead, they exist on a two-dimensional plane (a flat surface) and have no depth.
<h2 class="heading settled heading" data-level=2 id=module-interactions><span class=secno>2 </span><span class=content>Module Interactions</span><a class=self-link href=#module-interactions></a></h2>
<p>This module defines a set of CSS properties that affect the visual rendering of elements to which those properties are applied; these effects are applied after elements have been sized and positioned according to the <a href=http://www.w3.org/TR/CSS2/visuren.html title="Visual formatting model">Visual formatting model</a> from <a data-biblio-type=normative data-link-type=biblio href=#css21 title=css21>[CSS21]</a>. Some values of these properties result in the creation of a <a href=http://www.w3.org/TR/CSS2/visuren.html#containing-block title="Visual formatting model">containing block</a>, and/or the creation of a <a data-link-spec=css21 data-link-type=dfn href=http://www.w3.org/TR/CSS21/visuren.html#x43 title="stacking context">stacking context</a>.
<p>Three-dimensional transforms can also affect the visual layering of elements, and thus override the back-to-front painting order described in <a href=http://www.w3.org/TR/CSS2/zindex.html title="Elaborate description of Stacking Contexts">Appendix E</a> of <a data-biblio-type=normative data-link-type=biblio href=#css21 title=css21>[CSS21]</a>.
<p>Transforms affect the rendering of backgrounds on elements with a value of <span class=css data-link-type=maybe title=fixed>fixed</span> for the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-4/#background-attachment title=background-attachment>background-attachment</a> property, which is specified in <a data-biblio-type=normative data-link-type=biblio href=#css3bg title=css3bg>[CSS3BG]</a>.
<h2 class="heading settled heading" data-level=3 id=css-values><span class=secno>3 </span><span class=content>CSS Values</span><a class=self-link href=#css-values></a></h2>
<p>This specification follows the <a href=http://www.w3.org/TR/CSS21/about.html#property-defs>CSS property definition conventions</a> 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 <a href=http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit>inherit</a> keyword as their property value. For readability it has not been repeated explicitly.
<h2 class="heading settled heading" data-level=4 id=terminology><span class=secno>4 </span><span class=content>Terminology</span><a class=self-link href=#terminology></a></h2>
<p>When used in this specification, terms have the meanings assigned in this section.
<dl>
<dt><dfn data-dfn-type=dfn data-noexport="" id=bounding-box>bounding box<a class=self-link href=#bounding-box></a></dfn></dt>
<dd>
A bounding box is the object bounding box for all SVG elements without an associated CSS layout box and the border box for all other elements. The bounding box of a table is the border box of its <a href=http://www.w3.org/TR/CSS21/tables.html#model>table wrapper box</a>, not its table box.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=transformable-element>transformable element<a class=self-link href=#transformable-element></a></dfn></dt>
<dd>
A transformable element is an element in one of these categories:
<ul>
<li>
an element whose layout is governed by the CSS box model which is either a <a href=http://www.w3.org/TR/CSS2/visuren.html#block-level>block-level</a> or <a href=http://www.w3.org/TR/CSS2/visuren.html#x13>atomic inline-level element</a>, or whose <a class=property data-link-type=propdesc href=http://www.w3.org/TR/CSS21/visuren.html#propdef-display title=display>display</a> property computes to <span class=css data-link-type=maybe title=table-row>table-row</span>, <span class=css data-link-type=maybe title=table-row-group>table-row-group</span>, <span class=css data-link-type=maybe title=table-header-group>table-header-group</span>, <span class=css data-link-type=maybe title=table-footer-group>table-footer-group</span>, <span class=css data-link-type=maybe title=table-cell>table-cell</span>, or <span class=css data-link-type=maybe title=table-caption>table-caption</span> <a data-biblio-type=normative data-link-type=biblio href=#css21 title=css21>[CSS21]</a>
</li>
<li>
an element in the SVG namespace and not governed by the CSS box model which has the attributes <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a>, <a class=attr-name href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElementPatternTransformAttribute>‘patternTransform‘</a> or <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElementGradientTransformAttribute title=gradienttransform>gradientTransform</a> <a data-biblio-type=normative data-link-type=biblio href=#svg11 title=svg11>[SVG11]</a>.
</li>
</ul>
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=user-coordinate-system>user coordinate system<a class=self-link href=#user-coordinate-system></a></dfn></dt>
<dt><dfn data-dfn-type=dfn data-noexport="" id=local-coordinate-system>local coordinate system<a class=self-link href=#local-coordinate-system></a></dfn></dt>
<dd>
In general, a coordinate system defines locations and distances on the current canvas. The current local coordinate system (also user coordinate system) is the coordinate system that is currently active and which is used to define how coordinates and lengths are located and computed, respectively, on the current canvas.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=perspective-matrix>perspective matrix<a class=self-link href=#perspective-matrix></a></dfn></dt>
<dd>
A matrix computed from the values of the <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> and <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> properties as described <a href=#perspective-matrix-computation>below</a>.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=transformation-matrix>transformation matrix<a class=self-link href=#transformation-matrix></a></dfn></dt>
<dd>
A matrix that defines the mathematical mapping from one coordinate system into another. It is computed from the values of the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> and <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> properties as described <a href=#transformation-matrix-computation>below</a>.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=current-transformation-matrix-ctm>current transformation matrix (CTM)<a class=self-link href=#current-transformation-matrix-ctm></a></dfn></dt>
<dd>
A matrix that defines the mapping from the local coordinate system into the viewport coordinate system.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=accumulated-3d-transformation-matrix>accumulated 3D transformation matrix<a class=self-link href=#accumulated-3d-transformation-matrix></a></dfn></dt>
<dd>
A matrix computed for elements in a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a>, as described <a href=#accumulated-3d-transformation-matrix-computation>below</a>.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=2d-matrix>2D matrix<a class=self-link href=#2d-matrix></a></dfn></dt>
<dd>
A 3x2 transformation matrix with 6 items or a 4x4 matrix with 16 items, where the items m<sub>31</sub>, m<sub>32</sub>, m<sub>13</sub>, m<sub>23</sub>, m<sub>43</sub>, m<sub>14</sub>, m<sub>24</sub>, m<sub>34</sub> are equal to <span class=css data-link-type=maybe title=0>0</span> and m<sub>33</sub>, m<sub>44</sub> are equal to <span class=css data-link-type=maybe title=1>1</span>.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=3d-matrix>3D matrix<a class=self-link href=#3d-matrix></a></dfn></dt>
<dd>
A 4x4 matrix which does not fulfill the requirements of an <a data-link-type=dfn href=#2d-matrix title="2d matrix">2D matrix</a>.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=identity-transform-function>identity transform function<a class=self-link href=#identity-transform-function></a></dfn></dt>
<dd>
A <a href=#transform-functions>transform function</a> that is equivalent to a identity 4x4 matrix (see <a href=#mathematical-description>Mathematical Description of Transform Functions</a>). Examples for identity transform functions are <span class=css data-link-type=maybe title=translate(0)>translate(0)</span>, <span class=css data-link-type=maybe title="translate3d(0, 0, 0)">translate3d(0, 0, 0)</span>, <span class=css data-link-type=maybe title=translatex(0)>translateX(0)</span>, <span class=css data-link-type=maybe title=translatey(0)>translateY(0)</span>, <span class=css data-link-type=maybe title=translatez(0)>translateZ(0)</span>, <span class=css data-link-type=maybe title=scale(1)>scale(1)</span>, <span class=css data-link-type=maybe title=scalex(1)>scaleX(1)</span>, <span class=css data-link-type=maybe title=scaley(1)>scaleY(1)</span>, <span class=css data-link-type=maybe title=scalez(1)>scaleZ(1)</span>, <span class=css data-link-type=maybe title=rotate(0)>rotate(0)</span>, <span class=css data-link-type=maybe title="rotate3d(1, 1, 1, 0)">rotate3d(1, 1, 1, 0)</span>, <span class=css data-link-type=maybe title=rotatex(0)>rotateX(0)</span>, <span class=css data-link-type=maybe title=rotatey(0)>rotateY(0)</span>, <span class=css data-link-type=maybe title=rotatez(0)>rotateZ(0)</span>, <span class=css data-link-type=maybe title="skew(0, 0)">skew(0, 0)</span>, <span class=css data-link-type=maybe title=skewx(0)>skewX(0)</span>, <span class=css data-link-type=maybe title=skewy(0)>skewY(0)</span>, <span class=css data-link-type=maybe title="matrix(1, 0, 0, 1, 0, 0)">matrix(1, 0, 0, 1, 0, 0)</span> and <span class=css data-link-type=maybe title="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)">matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)</span>. A special case is perspective: <span class=css data-link-type=maybe title=perspective(infinity)>perspective(infinity)</span>. The value of m<sub>34</sub> becomes infinitesimal small and the transform function is therefore assumed to be equal to the identity matrix.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=3d-rendering-context>3D rendering context<a class=self-link href=#3d-rendering-context></a></dfn></dt>
<dd>
A containing block hierarchy of one or more levels, instantiated by elements with a computed value for the <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a> property of <span class=css data-link-type=maybe title=preserve-3d>preserve-3d</span>, whose elements share a common three-dimensional coordinate system.
</dd>
</dl>
<h2 class="heading settled heading" data-level=5 id=two-dimensional-subset><span class=secno>5 </span><span class=content>Two Dimensional Subset</span><a class=self-link href=#two-dimensional-subset></a></h2>
<p>UAs may not always be able to render three-dimensional transforms and then just support a two-dimensional subset of this specification. In this case <a href=#three-d-transform-functions>three-dimensional transforms</a> and the properties <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a>, <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a>, <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> and <a class=property data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility</a> must not be supported. Section <a href=#3d-transform-rendering>3D Transform Rendering</a> does not apply. Matrix decomposing uses the technique taken from the "unmatrix" method in "Graphics Gems II, edited by Jim Arvo", simplified for the 2D case. Section <a href=#mathematical-description>Mathematical Description of Transform Functions</a> is still effective but can be reduced by using a 3x3 transformation matrix where <em>a</em> equals m<sub>11</sub>, <em>b</em> equals m<sub>12</sub>, <em>c</em> equals m<sub>21</sub>, <em>d</em> equals m<sub>22</sub>, <em>e</em> equals m<sub>41</sub> and <em>f</em> equals m<sub>42</sub> (see <a href=#MatrixDefined>A 2D 3x2 matrix with six parameter</a>).
<div class=figure>
<img alt="3x3 matrix" height=79 src=3x3matrix.png title="\begin{bmatrix} a & c & e \\ b
& d & f \\ 0 & 0 & 1 \end{bmatrix}" width=82>
<p class=caption>
3x3 matrix for two-dimensional transformations.
</p>
</div>
<div class=example>
<p>
Authors can easily provide a fallback if UAs do not provide support for three-dimensional transforms. The following example has two property definitions for <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a>. The first one consists of two two-dimensional transform functions. The second one has a two-dimensional and a three-dimensional transform function.
</p>
<pre>div {
transform: scale(2) rotate(45deg);
transform: scale(2) rotate3d(0, 0, 1, 45deg);
}</pre>
<p>
With 3D support, the second definition will override the first one. Without 3D support, the second definition is invalid and a UA falls back to the first definition.
</p>
</div>
<h2 class="heading settled heading" data-level=6 id=transform-rendering><span class=secno>6 </span><span class=content>The Transform Rendering Model</span><a class=self-link href=#transform-rendering></a></h2>
<p><em>This section is normative.</em>
<p>Specifying a value other than <a class=css data-link-type=maybe href=#none title=none>none</a> for the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> property establishes a new <a data-link-type=dfn href=#local-coordinate-system title="local coordinate system">local coordinate system</a> at the element that it is applied to. The mapping from where the element would have rendered into that local coordinate system is given by the element’s <a data-link-type=dfn href=#transformation-matrix title="transformation matrix">transformation matrix</a>. Transformations are cumulative. That is, elements establish their local coordinate system within the coordinate system of their parent. From the perspective of the user, an element effectively accumulates all the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> properties of its ancestors as well as any local transform applied to it. The accumulation of these transforms defines a <a data-link-type=dfn href=#current-transformation-matrix-ctm title="current transformation matrix (ctm)">current transformation matrix (CTM)</a> for the element.
<p>The coordinate space is a coordinate system with two axes: the X axis increases horizontally to the right; the Y axis increases vertically downwards. Three-dimensional transform functions extend this coordinate space into three dimensions, adding a Z axis perpendicular to the plane of the screen, that increases towards the viewer.
<div class=figure>
<img alt="Demonstration of the initial coordinate space" height=240 src=coordinates.svg width=270>
<p class=caption>
Demonstration of the initial coordinate space.
</p>
</div>
<p id=transformation-matrix-computation>
The <a data-link-type=dfn href=#transformation-matrix title="transformation matrix">transformation matrix</a> is computed from the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> and <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> properties as follows:
<ol>
<li>Start with the identity matrix.</li>
<li>Translate by the computed X, Y and Z values of <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a></li>
<li>Multiply by each of the transform functions in <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> property from left to right</li>
<li>Translate by the negated computed X, Y and Z values of <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a></li>
</ol>
<p></p>
<p>Transforms apply to <a data-link-type=dfn href=#transformable-element title="transformable elements">transformable elements</a>.
<p class=note>Note: Transformations do affect the visual layout on the canvas, but have no affect on the CSS layout itself. This also means transforms do not affect results of the Element Interface Extensions <a href=http://www.w3.org/TR/cssom-view/#dom-element-getclientrects>getClientRects()</a> and <a href=http://www.w3.org/TR/cssom-view/#dom-element-getboundingclientrect>getBoundingClientRect()</a>, which are specified in <a data-biblio-type=informative data-link-type=biblio href=#cssom-view title=cssom-view>[CSSOM-VIEW]</a>.
<div class=example>
<pre>div {
transform: translate(100px, 100px);
}</pre> <p>
This transform moves the element by 100 pixels in both the X and Y directions.
</p>
<div class=figure>
<img alt="The 100px translation in X and Y" height=250 src=examples/translate1.svg width=470>
</div>
</div>
<div class=example>
<pre>div {
height: 100px; width: 100px;
transform-origin: 50px 50px;
transform: rotate(45deg);
}</pre>
<p>
The <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> property moves the point of origin by 50 pixels in both the X and Y directions. The transform rotates the element clockwise by 45° about the point of origin. After all transform functions were applied, the translation of the origin gets translated back by -50 pixels in both the X and Y directions.
</p>
<div class=figure>
<img alt="The point of origin gets translated temporary" height=250 src=examples/origin1.svg width=735>
</div>
</div>
<div class=example>
<pre>div {
height: 100px; width: 100px;
transform: translate(80px, 80px) scale(1.5, 1.5) rotate(45deg);
}</pre>
<p>
This transform moves the element by 80 pixels in both the X and Y directions, then scales the element by 150%, then rotates it 45° clockwise about the Z axis. Note that the scale and rotation operate about the center of the element, since the element has the default transform-origin of <span class=css data-link-type=maybe title="50% 50%">50% 50%</span>.
</p>
<div class=figure>
<img alt="The transform specified above" height=270 src=examples/compound_transform.svg width=270>
</div>
<p class=note>
Note that an identical rendering can be obtained by nesting elements with the equivalent transforms:
</p>
<pre><div style="transform: translate(80px, 80px)">
<div style="transform: scale(1.5, 1.5)">
<div style="transform: rotate(45deg)"></div>
</div>
</div></pre></div>
<p>For elements whose layout is governed by the CSS box model, the transform property does not affect the flow of the content surrounding the transformed element. However, the extent of the overflow area takes into account transformed elements. This behavior is similar to what happens when elements are offset via relative positioning. Therefore, if the value of the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-overflow-3/#overflow title=overflow>overflow</a> property is <span class=css data-link-type=maybe title=scroll>scroll</span> or <span class=css data-link-type=maybe title=auto>auto</span>, scrollbars will appear as needed to see content that is transformed outside the visible area.
<p>For elements whose layout is governed by the CSS box model, any value other than <a class=css data-link-type=maybe href=#none title=none>none</a> for the transform results in the creation of both a stacking context and a containing block. The object acts as a containing block for fixed positioned descendants.
<p class=issue id=issue-ba073826><a class=self-link href=#issue-ba073826></a>
Is this effect on <a class=css data-link-type=propdesc href=http://dev.w3.org/csswg/css-position-3/#position title=position>position: fixed</a> necessary? If so, need to go into more detail here about why fixed positioned objects should do this, i.e., that it’s much harder to implement otherwise. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328">Bug 16328</a>.
</p>
<p><a href=http://www.w3.org/TR/css3-background/#fixed0>Fixed backgrounds</a> on the root element are affected by any transform specified for that element. For all other elements that are effected by a transform (i.e. have a transform applied to them, or to any of their ancestor elements), a value of <span class=css data-link-type=maybe title=fixed>fixed</span> for the <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-4/#background-attachment title=background-attachment>background-attachment</a> property is treated as if it had a value of <span class=css data-link-type=maybe title=scroll>scroll</span>. The computed value of <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-backgrounds-4/#background-attachment title=background-attachment>background-attachment</a> is not affected.
<p class=note>Note: If the root element is transformed, the transformation applies to the entire canvas, including any background specified for the root element. Since <a href=http://www.w3.org/TR/css3-background/#special-backgrounds>the background painting area for the root element</a> is the entire canvas, which is infinite, the transformation might cause parts of the background that were originally off-screen to appear. For example, if the root element’s background were repeating dots, and a transformation of <span class=css data-link-type=maybe title=scale(0.5)>scale(0.5)</span> were specified on the root element, the dots would shrink to half their size, but there will be twice as many, so they still cover the whole viewport.
<h3 class="heading settled heading" data-level=6.1 id=3d-transform-rendering><span class=secno>6.1 </span><span class=content>3D Transform Rendering</span><a class=self-link href=#3d-transform-rendering></a></h3>
<p>Normally, elements render as flat planes, and are rendered into the same plane as their containing block. Often this is the plane shared by the rest of the page. Two-dimensional transform functions can alter the appearance of an element, but that element is still rendered into the same plane as its containing block.
<p>Three-dimensional transforms can result in transformation matrices with a non-zero Z component (where the Z axis projects out of the plane of the screen). This can result in an element rendering on a different plane than that of its containing block. This may affect the front-to-back rendering order of that element relative to other elements, as well as causing it to intersect with other elements. This behavior depends on whether the element is a member of a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a>, as described below.
<div class=issue id=issue-145943d8><a class=self-link href=#issue-145943d8></a>
<p class=desc>
This description does not exactly match what WebKit implements. Perhaps it should be changed to match current implementations? See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=19637">Bug 19637</a>.
</p>
</div>
<div class=example>
<p>
This example shows the effect of three-dimensional transform applied to an element.
</p>
<pre><style>
div {
height: 150px;
width: 150px;
}
.container {
border: 1px solid black;
}
.transformed {
transform: rotateY(50deg);
}
</style>
<div class="container">
<div class="transformed"></div>
</div></pre> <div class=figure>
<img alt="Div with a rotateY transform." height=190 src=examples/simple-3d-example.png width=210>
</div>
<p>
The transform is a 50° rotation about the vertical, Y axis. Note how this makes the blue box appear narrower, but not three-dimensional.
</p>
</div>
<p>The <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> and <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> properties can be used to add a feeling of depth to a scene by making elements higher on the Z axis (closer to the viewer) appear larger, and those further away to appear smaller. The scaling is proportional to <var>d</var>/(<var>d</var> − <var>Z</var>) where <var>d</var>, the value of <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a>, is the distance from the drawing plane to the the assumed position of the viewer’s eye.
<div class=figure>
<img alt="Diagram of scale vs. Z position" src=perspective_distance.png>
<p class=caption>
Diagrams showing how scaling depends on the <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> property and Z position. In the top diagram, <var>Z</var> is half of <var>d</var>. In order to make it appear that the original circle (solid outline) appears at <var>Z</var> (dashed circle), the circle is scaled up by a factor of two, resulting in the light blue circle. In the bottom diagram, the circle is scaled down by a factor of one-third to make it appear behind the original position.
</p>
</div>
<p>Normally the assumed position of the viewer’s eye is centered on a drawing. This position can be moved if desired – for example, if a web page contains multiple drawings that should share a common perspective – by setting <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a>.
<div class=figure>
<img alt="Diagram of different perspective-origin" src=perspective_origin.png>
<p class=caption>
Diagram showing the effect of moving the perspective origin upward.
</p>
</div>
<p id=perspective-matrix-computation>
The <a data-link-type=dfn href=#perspective-matrix title="perspective matrix">perspective matrix</a> is computed as follows:
<ol>
<li>Start with the identity matrix.</li>
<li>Translate by the computed X and Y values of <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a></li>
<li>Multiply by the matrix that would be obtained from the <a class=css data-link-type=maybe href=#funcdef-perspective title=perspective()>perspective()</a> transform function, where the length is provided by the value of the <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> property</li>
<li>Translate by the negated computed X and Y values of <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a></li>
</ol>
<p></p>
<div class=example>
<p>
This example shows how perspective can be used to cause three-dimensional transforms to appear more realistic.
</p>
<pre><style>
div {
height: 150px;
width: 150px;
}
.container {
perspective: 500px;
border: 1px solid black;
}
.transformed {
transform: rotateY(50deg);
}
</style>
<div class="container">
<div class="transformed"></div>
</div></pre>
<div class=figure>
<img alt="Div with a rotateY transform, and perspective on its container" height=190 src=examples/simple-perspective-example.png width=210>
</div>
<p>
The inner element has the same transform as in the previous example, but its rendering is now influenced by the perspective property on its parent element. Perspective causes vertices that have positive Z coordinates (closer to the viewer) to be scaled up in X and Y, and those further away (negative Z coordinates) to be scaled down, giving an appearance of depth.
</p>
</div>
<p>An element with a three-dimensional transform that is not contained in a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> renders with the appropriate transform applied, but does not intersect with any other elements. The three-dimensional transform in this case can be considered just as a painting effect, like two-dimensional transforms. Similarly, the transform does not affect painting order. For example, a transform with a positive Z translation may make an element look larger, but does not cause that element to render in front of elements with no translation in Z.
<p>An element with a three-dimensional transform that is contained in a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> can visibly interact with other elements in that same 3D rendering context; the set of elements participating in the same <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> may obscure each other or intersect, based on their computed transforms. They are rendered as if they are all siblings, positioned in a common 3D coordinate space. The position of each element in that three-dimensional space is determined by accumulating the transformation matrices up from the element that establishes the <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> through each element that is a containing block for the given element, as described below.
<div class=example>
<pre><style>
div {
height: 150px;
width: 150px;
}
.container {
perspective: 500px;
border: 1px solid black;
}
.transformed {
transform: rotateY(50deg);
background-color: blue;
}
.child {
transform-origin: top left;
transform: rotateX(40deg);
background-color: lime;
}
</style>
<div class="container">
<div class="transformed">
<div class="child"></div>
</div>
</div>
</pre> <p>
This example shows how nested 3D transforms are rendered in the absence of <a class=css data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style: preserve-3d</a>. The blue div is transformed as in the previous example, with its rendering influenced by the perspective on its parent element. The lime element also has a 3D transform, which is a rotation about the X axis (anchored at the top, by virtue of the transform-origin). However, the lime element is being rendered into the plane of its parent because it is not a member of a 3D rendering context; the parent is "flattening".
</p>
<div class=figure>
<img alt="Nested 3D transforms, with flattening" height=200 src=examples/3d-rendering-context-flat.png width=240>
</div>
</div>
<p>Elements establish and participate in 3D rendering contexts as follows:
<p><ul>
<li>
A <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> is established by a a <a data-link-type=dfn href=#transformable-element title="transformable element">transformable element</a> whose computed value for <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a> is <span class=css data-link-type=maybe title=preserve-3d>preserve-3d</span>, and which itself is not part of a 3D rendering context. Note that such an element is always a containing block. An element that establishes a 3D rendering context also participates in that context.
</li>
<li>
An element whose computed value for <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a> is <span class=css data-link-type=maybe title=preserve-3d>preserve-3d</span>, and which itself participates in a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a>, extends that 3D rendering context rather than establishing a new one.
</li>
<li>
An element participates in a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> if its containing block establishes or extends a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a>.
</li>
</ul>
<p id=accumulated-3d-transformation-matrix-computation>
The final value of the transform used to render an element in a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> is computed by accumulating an <a data-link-type=dfn href=#accumulated-3d-transformation-matrix title="accumulated 3d transformation matrix">accumulated 3D transformation matrix</a> as follows:
</p>
<ol>
<li>Start with the identity matrix.</li>
<li>For each containing block between the root of the <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> and the element in question:
<ol>
<li>multiply the accumulated matrix with the <a data-link-type=dfn href=#perspective-matrix title="perspective matrix">perspective matrix</a> on the element’s containing block (if any). That containing block is not necessarily a member of the 3D rendering context.</li>
<li>apply to the accumulated matrix a translation equivalent to the horizontal and vertical offset of the element relative to its containing block as specified by the CSS visual formatting model.</li>
<li>multiply the accumulated matrix with the <a data-link-type=dfn href=#transformation-matrix title="transformation matrix">transformation matrix</a>.</li>
</ol>
</li>
</ol>
<div class=example>
<pre><style>
div {
height: 150px;
width: 150px;
}
.container {
perspective: 500px;
border: 1px solid black;
}
.transformed {
<b>transform-style: preserve-3d</b>;
transform: rotateY(50deg);
background-color: blue;
}
.child {
transform-origin: top left;
transform: rotateX(40deg);
background-color: lime;
}
</style></pre>
<p>
This example is identical to the previous example, with the addition of <a class=css data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style: preserve-3d</a> on the blue element. The blue element now establishes a 3D rendering context, of which the lime element is a member. Now both blue and lime elements share a common three-dimensional space, so the lime element renders as tilting out from its parent, influenced by the perspective on the container.
</p>
<div class=figure>
<img alt="Nested 3D transforms, with preserve-3d." height=200 src=examples/3d-rendering-context-3d.png width=240>
</div>
</div>
<p>Elements in the same <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> may intersect with each other. User agents must render intersection by subdividing the planes of intersecting elements as described by <a href=http://en.wikipedia.org/wiki/Newell%27s_algorithm>Newell’s algorithm</a>.
<p>Untransformed elements in a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> render on the Z=0 plane, yet may still intersect with transformed elements.
<p>Within a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a>, the rendering order of non-intersecting elements is based on their position on the Z axis after the application of the accumulated transform. Elements at the same Z position render in <a href=http://www.w3.org/TR/CSS2/zindex.html#painting-order>stacking context order</a>.
<div class=example>
<pre><style>
.container {
background-color: rgba(0, 0, 0, 0.3);
transform-style: preserve-3d;
perspective: 500px;
}
.container > div {
position: absolute;
left: 0;
}
.container > :first-child {
transform: rotateY(45deg);
background-color: orange;
top: 10px;
height: 135px;
}
.container > :last-child {
transform: translateZ(40px);
background-color: rgba(0, 0, 255, 0.75);
top: 50px;
height: 100px;
}
</style>
<div class="container">
<div></div>
<div></div>
</div></pre>
<p>
This example shows show elements in a 3D rendering context can intersect. The container element establishes a 3D rendering context for itself and its two children. The children intersect with each other, and the orange element also intersects with the container.
</p>
<div class=figure>
<img alt="Intersecting sibling elements." height=200 src=examples/3d-intersection.png width=200>
</div>
</div>
<p>Using three-dimensional transforms, it’s possible to transform an element such that its reverse side is towards the viewer. 3D-transformed elements show the same content on both sides, so the reverse side looks like a mirror-image of the front side (as if the element were projected onto a sheet of glass). Normally, elements whose reverse side is towards the viewer remain visible. However, the <a class=property data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility</a> property allows the author to make an element invisible when its reverse side is towards the viewer. This behavior is "live"; if an element with <a class=css data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility: hidden</a> were animating, such that its front and reverse sides were alternately visible, then it would only be visible when the front side were towards the viewer.
<div class=issue id=issue-8cd85be3><a class=self-link href=#issue-8cd85be3></a>
<p class=desc>
This wording needs clarification; <a class=property data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility</a> works per-3D rendering context, not relative to the root.
</p>
</div>
<h3 class="heading settled heading" data-level=6.2 id=processing-of-perspective-transformed-boxes><span class=secno>6.2 </span><span class=content>
Processing of Perspective-Transformed Boxes
</span><a class=self-link href=#processing-of-perspective-transformed-boxes></a></h3>
<div class=issue id=issue-7ef0653c><a class=self-link href=#issue-7ef0653c></a>
<p class=desc>
This is a first pass at an attempt to precisely specify how exactly to transform elements using the provided matrices. It might not be ideal, and implementer feedback is encouraged. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=15605">bug 15605</a>.
</p>
</div>
<p>The <a data-link-type=dfn href=#accumulated-3d-transformation-matrix title="accumulated 3d transformation matrix">accumulated 3D transformation matrix</a> is a 4×4 matrix, while the objects to be transformed are two-dimensional boxes. To transform each corner (<var>a</var>, <var>b</var>) of a box, the matrix must first be applied to (<var>a</var>, <var>b</var>, 0, 1), which will result in a four-dimensional point (<var>x</var>, <var>y</var>, <var>z</var>, <var>w</var>). This is transformed back to a three-dimensional point (<var>x</var>′, <var>y</var>′, <var>z</var>′) as follows:
<p>If <var>w</var> > 0, (<var>x</var>′, <var>y</var>′, <var>z</var>′) = (<var>x</var>/<var>w</var>, <var>y</var>/<var>w</var>, <var>z</var>/<var>w</var>).
<p>If <var>w</var> = 0, (<var>x</var>′, <var>y</var>′, <var>z</var>′) = (<var>x</var> ⋅ <var>n</var>, <var>y</var> ⋅ <var>n</var>, <var>z</var> ⋅ <var>n</var>). <var>n</var> is an implementation-dependent value that should be chosen so that <var>x</var>′ or <var>y</var>′ is much larger than the viewport size, if possible. For example, (5px, 22px, 0px, 0) might become (5000px, 22000px, 0px), with <var>n</var> = 1000, but this value of <var>n</var> would be too small for (0.1px, 0.05px, 0px, 0). This specification does not define the value of <var>n</var> exactly. Conceptually, (<var>x</var>′, <var>y</var>′, <var>z</var>′) is <a href=http://en.wikipedia.org/wiki/Plane_at_infinity>infinitely far</a> in the direction (<var>x</var>, <var>y</var>, <var>z</var>).
<p>If <var>w</var> < 0 for all four corners of the transformed box, the box is not rendered.
<p>If <var>w</var> < 0 for one to three corners of the transformed box, the box must be replaced by a polygon that has any parts with <var>w</var> < 0 cut out. This will in general be a polygon with three to five vertices, of which exactly two will have <var>w</var> = 0 and the rest <var>w</var> > 0. These vertices are then transformed to three-dimensional points using the rules just stated. Conceptually, a point with <var>w</var> < 0 is "behind" the viewer, so should not be visible.
<div class=example>
<pre><style>
.transformed {
height: 100px;
width: 100px;
background: lime;
transform: perspective(50px) translateZ(100px);
}
</style></pre>
<p>
All of the box’s corners have <var>z</var>-coordinates greater than the perspective. This means that the box is behind the viewer and will not display. Mathematically, the point (<var>x</var>, <var>y</var>) first becomes (<var>x</var>, <var>y</var>, 0, 1), then is translated to (<var>x</var>, <var>y</var>, 100, 1), and then applying the perspective results in (<var>x</var>, <var>y</var>, 100, −1). The <var>w</var>-coordinate is negative, so it does not display. An implementation that doesn’t handle the <var>w</var> < 0 case separately might incorrectly display this point as (−<var>x</var>, −<var>y</var>, −100), dividing by −1 and mirroring the box.
</p>
</div>
<div class=example>
<pre><style>
.transformed {
height: 100px;
width: 100px;
background: radial-gradient(yellow, blue);
transform: perspective(50px) translateZ(50px);
}
</style></pre>
<p>
Here, the box is translated upward so that it sits at the same place the viewer is looking from. This is like bringing the box closer and closer to one’s eye until it fills the entire field of vision. Since the default transform-origin is at the center of the box, which is yellow, the screen will be filled with yellow.
</p>
<p>
Mathematically, the point (<var>x</var>, <var>y</var>) first becomes (<var>x</var>, <var>y</var>, 0, 1), then is translated to (<var>x</var>, <var>y</var>, 50, 1), then becomes (<var>x</var>, <var>y</var>, 50, 0) after applying perspective. Relative to the transform-origin at the center, the upper-left corner was (−50, −50), so it becomes (−50,
−50, 50, 0). This is transformed to something very far to the upper left, such as (−5000, −5000, 5000). Likewise the other corners are sent very far away. The radial gradient is stretched over the whole box, now enormous, so the part that’s visible without scrolling should be the color of the middle pixel: yellow. However, since the box is not actually infinite, the user can still scroll to the edges to see the blue parts.
</p>
</div>
<div class=issue id=issue-8eb820d3><a class=self-link href=#issue-8eb820d3></a>
<p class=desc>
WebKit doesn’t render this box unless the translateZ() is < 50px.
</p>
</div>
<div class=example>
<pre><style>
.transformed {
height: 50px;
width: 50px;
background: lime;
border: 25px solid blue;
transform-origin: left;
transform: perspective(50px) rotateY(-45deg);
}
</style></pre>
<p>
The box will be rotated toward the viewer, with the left edge staying fixed while the right edge swings closer. The right edge will be at about <var>z</var> = <span class=css data-link-type=maybe title=70.7px>70.7px</span>, which is closer than the perspective of <span class=css data-link-type=maybe title=50px>50px</span>. Therefore, the rightmost edge will vanish ("behind" the viewer), and the visible part will stretch out infinitely far to the right.
</p>
<p>
Mathematically, the top right vertex of the box was originally (100, −50), relative to the transform-origin. It is first expanded to (100, −50, 0, 1). After applying the transform specified, this will get mapped to about (70.71, −50, 70.71, −0.4142). This has <var>w</var> = −0.4142 < 0, so we need to slice away the part of the box with <var>w</var> < 0. This results in the new top-right vertex being (50, −50, 50, 0). This is then mapped to some faraway point in the same direction, such as (5000, −5000, 5000), which is up and to the right from the transform-origin. Something similar is done to the lower right corner, which gets mapped far down and to the right. The resulting box stretches far past the edge of the screen.
</p>
<p>
Again, the rendered box is still finite, so the user can scroll to see the whole thing if he or she chooses. However, the right part has been chopped off. No matter how far the user scrolls, the rightmost <span class=css data-link-type=maybe title=30px>30px</span> or so of the original box will not be visible. The blue border was only <span class=css data-link-type=maybe title=25px>25px</span> wide, so it will be visible on the left, top, and bottom, but not the right.
</p>
<p>
The same basic procedure would apply if one or three vertices had <var>w</var> < 0. However, in that case the result of truncating the <var>w</var> < 0 part would be a triangle or pentagon instead of a quadrilateral.
</p>
</div>
<h2 class="heading settled heading" data-level=7 id=transform-property><span class=secno>7 </span><span class=content>The <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> Property</span><a class=self-link href=#transform-property></a></h2>
<p>A transformation is applied to the coordinate system an element renders in through the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> property. This property contains a list of <a href=#transform-functions>transform functions</a>. The final transformation value for a coordinate system is obtained by converting each function in the list to its corresponding matrix like defined in <a href=#mathematical-description>Mathematical Description of Transform Functions</a>, then multiplying the matrices.
<table class=propdef><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-transform>transform<a class=self-link href=#propdef-transform></a></dfn><tr><th>Value:<td>none | <a class="production css-code" data-link-type=type href=#typedef-transform-list title="<transform-list>"><transform-list></a><tr><th>Initial:<td>none<tr><th>Applies to:<td><a data-link-type=dfn href=#transformable-element title="transformable elements">transformable elements</a><tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>As specified, but with relative lengths converted into absolute lengths.<tr><th>Percentages:<td>refer to the size of <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a><tr><th>Animatable:<td>as <a href=#interpolation-of-transforms>transform</a></table>
<p>Any computed value other than <a class=css data-link-type=maybe href=#none title=none>none</a> for the transform results in the creation of both a stacking context and a containing block. The object acts as a containing block for fixed positioned descendants.
<pre class=prod><dfn class=css-code data-dfn-type=type data-export="" id=typedef-transform-list><transform-list><a class=self-link href=#typedef-transform-list></a></dfn> = <a class="production css-code" data-link-type=type href=#typedef-transform-function title="<transform-function>"><transform-function></a>+</pre>
<h2 class="heading settled heading" data-level=8 id=transform-origin-property><span class=secno>8 </span><span class=content>The <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> Property</span><a class=self-link href=#transform-origin-property></a></h2>
<table class=propdef><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-transform-origin>transform-origin<a class=self-link href=#propdef-transform-origin></a></dfn><tr><th>Value:<td> [ left | center | right | top | bottom | <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="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> ]<br> | <br> [ left | center | right | <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="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> ]<br> [ top | center | bottom | <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="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/#length-value title="<length>"><length></a>?<br> |<br> [ center | [ left | right ] ] && [ center | [ top | bottom ] ] <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a>?<tr><th>Initial:<td>50% 50%<tr><th>Applies to:<td><a data-link-type=dfn href=#transformable-element title="transformable elements">transformable elements</a><tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>For <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> the absolute value, otherwise a percentage<tr><th>Percentages:<td>refer to the size of <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a><tr><th>Animatable:<td>as <a href=http://dev.w3.org/csswg/css3-transitions/#animtype-simple-list>simple list</a> of <a href=http://dev.w3.org/csswg/css3-transitions/#animtype-lpcalc>length, percentage, or calc</a></table>
<p>The default value for SVG elements without associated CSS layout box is <span class=css data-link-type=maybe title="0 0">0 0</span>.
<p>The values of the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> and <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> properties are used to compute the <a data-link-type=dfn href=#transformation-matrix title="transformation matrix">transformation matrix</a>, as described above.
<p>If only one value is specified, the second value is assumed to be <a class=css-code data-link-for=transform-origin data-link-type=value href=#valuedef-center0 title=center>center</a>. If one or two values are specified, the third value is assumed to be <span class=css data-link-type=maybe title=0px>0px</span>.
<p>If two or more values are defined and either no value is a keyword, or the only used keyword is <a class=css-code data-link-for=transform-origin data-link-type=value href=#valuedef-center0 title=center>center</a>, then the first value represents the horizontal position (or offset) and the second represents the vertical position (or offset). A third value always represents the Z position (or offset) and must be of type <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a>.
<dl data-dfn-for=transform-origin data-dfn-type=value>
<dt><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>
<dd>
A percentage for the horizontal offset is relative to the width of the <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>. A percentage for the vertical offset is relative to height of the <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>. The value for the horizontal and vertical offset represent an offset from the top left corner of the <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>.
</dd>
<dt><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a></dt>
<dd>
<p>
A length value gives a fixed length as the offset. The value for the horizontal and vertical offset represent an offset from the top left corner of the <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>.
</p>
<p>
For SVG elements without an associated CSS layout box the horizontal and vertical offset represent an offset from the point of origin of the element’s local coordinate space.
</p>
</dd>
<dt><dfn class=css-code data-dfn-for=transform-origin data-dfn-type=value data-export="" id=valuedef-top0>top<a class=self-link href=#valuedef-top0></a></dfn>
<dd>Computes to <span class=css data-link-type=maybe title=0%>0%</span> for the vertical position.
<dt><dfn class=css-code data-dfn-for=transform-origin data-dfn-type=value data-export="" id=valuedef-right0>right<a class=self-link href=#valuedef-right0></a></dfn>
<dd>Computes to <span class=css data-link-type=maybe title=100%>100%</span> for the horizontal position.
<dt><dfn class=css-code data-dfn-for=transform-origin data-dfn-type=value data-export="" id=valuedef-bottom0>bottom<a class=self-link href=#valuedef-bottom0></a></dfn>
<dd>Computes to <span class=css data-link-type=maybe title=100%>100%</span> for the vertical position.
<dt><dfn class=css-code data-dfn-for=transform-origin data-dfn-type=value data-export="" id=valuedef-left0>left<a class=self-link href=#valuedef-left0></a></dfn>
<dd>Computes to <span class=css data-link-type=maybe title=0%>0%</span> for the horizontal position.
<dt><dfn class=css-code data-dfn-for=transform-origin data-dfn-type=value data-export="" id=valuedef-center0>center<a class=self-link href=#valuedef-center0></a></dfn>
<dd>
Computes to <span class=css data-link-type=maybe title=50%>50%</span> (<span class=css data-link-type=maybe title="left 50%">left 50%</span>) for the horizontal position if the horizontal position is not otherwise specified, or <span class=css data-link-type=maybe title=50%>50%</span> (<span class=css data-link-type=maybe title="top 50%">top 50%</span>) for the vertical position if it is.
</dl>
<p>The <a href=http://www.w3.org/TR/cssom/#resolved-value>resolved value</a> of <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> is the <a href=http://www.w3.org/TR/CSS21/cascade.html#used-value>used value</a> (i.e., percentages are resolved to absolute lengths).
<h2 class="heading settled heading" data-level=9 id=transform-style-property><span class=secno>9 </span><span class=content>The <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a> Property</span><a class=self-link href=#transform-style-property></a></h2>
<table class=propdef><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-transform-style>transform-style<a class=self-link href=#propdef-transform-style></a></dfn><tr><th>Value:<td>flat | preserve-3d<tr><th>Initial:<td>flat<tr><th>Applies to:<td><a data-link-type=dfn href=#transformable-element title="transformable elements">transformable elements</a><tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>Same as specified value.<tr><th>Percentages:<td>N/A<tr><th>Animatable:<td>no</table>
<p>A value of <span class=css data-link-type=maybe title=preserve-3d>preserve-3d</span> for <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a> establishes a stacking context.
<p class=issue id=issue-0f144852><a class=self-link href=#issue-0f144852></a>Keyword description missing. Description of flattening behavior is missing. Does rendering operate in <a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-position-3/#z-index title=z-index>z-index</a> order? Do we still create a 3D context and let planes intersect? See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=22427">Bug 22427</a> <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=23015">Bug 23015</a>.</p>
<p>The following CSS property values require the user agent to create a flattened representation of the descendant elements before they can be applied, and therefore override the behavior of <a class=css data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style: preserve-3d</a>:
<p><ul>
<li><a class=property data-link-type=propdesc href=http://dev.w3.org/csswg/css-overflow-3/#overflow title=overflow>overflow</a>: any value other than <span class=css data-link-type=maybe title=visible>visible</span>.</li>
<li><a class=property data-link-type=propdesc href=http://dev.w3.org/fxtf/filters/#propdef-filter title=filter>filter</a>: any value other than <a class=css data-link-type=maybe href=#none title=none>none</a>.</li>
<li><a class=property data-link-type=propdesc href=http://dev.w3.org/fxtf/masking/#propdef-clip title=clip>clip</a>: any value other than <span class=css data-link-type=maybe title=auto>auto</span>.</li>
<li><a class=property data-link-type=propdesc href=http://dev.w3.org/fxtf/masking/#propdef-clip-path title=clip-path>clip-path</a>: any value other than <a class=css data-link-type=maybe href=#none title=none>none</a>.</li>
<li><a class=property data-link-type=propdesc href=http://dev.w3.org/fxtf/compositing-1/#propdef-isolation title=isolation>isolation</a>: used value of <span class=css data-link-type=maybe title=isolate>isolate</span>.</li>
<li><a class=property data-link-type=propdesc href=http://dev.w3.org/fxtf/masking/#propdef-mask-image title=mask-image>mask-image</a>: any value other than <a class=css data-link-type=maybe href=#none title=none>none</a>.</li>
<li><a class=property data-link-type=propdesc href=http://dev.w3.org/fxtf/masking/#propdef-mask-box-image-source title=mask-box-image-source>mask-box-image-source</a>: any value other than <a class=css data-link-type=maybe href=#none title=none>none</a>.</li>
<li><a class=property data-link-type=propdesc href=http://dev.w3.org/fxtf/compositing-1/#propdef-mix-blend-mode title=mix-blend-mode>mix-blend-mode</a>: any value other than <span class=css data-link-type=maybe title=normal>normal</span>.</li>
</ul>
<p>The computed value of <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a> is not affected.
<p>The values of the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> and <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> properties are used to compute the <a data-link-type=dfn href=#transformation-matrix title="transformation matrix">transformation matrix</a>, as described above.
<h2 class="heading settled heading" data-level=10 id=perspective-property><span class=secno>10 </span><span class=content>The <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> Property</span><a class=self-link href=#perspective-property></a></h2>
<table class=propdef><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-perspective>perspective<a class=self-link href=#propdef-perspective></a></dfn><tr><th>Value:<td>none | <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a><tr><th>Initial:<td>none<tr><th>Applies to:<td><a data-link-type=dfn href=#transformable-element title="transformable elements">transformable elements</a><tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>Absolute length or "none".<tr><th>Percentages:<td>N/A<tr><th>Animatable:<td>as <a href=http://dev.w3.org/csswg/css3-transitions/#animtype-length>length</a></table>
<p>Where <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> values must be positive.
<dl data-dfn-for=perspective>
<dt><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a></dt>
<dd>
<p>Distance to the center of projection.
<p class=issue id=issue-eecf3b43><a class=self-link href=#issue-eecf3b43></a>Verify that projection is the distance to the center of projection.
</dd>
<dt><dfn data-dfn-type=dfn data-noexport="" id=none>none<a class=self-link href=#none></a></dfn></dt>
<dd>
No perspective transform is applied. The effect is mathematically similar to an infinite <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> value. All objects appear to be flat on the canvas.
</dd>
</dl>
<p>The use of this property with any value other than <a class=css data-link-type=maybe href=#none title=none>none</a> establishes a stacking context. It also establishes a containing block (somewhat similar to <a class=css data-link-type=propdesc href=http://dev.w3.org/csswg/css-position-3/#position title=position>position: relative</a>), just like the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> property does.
<p>The values of the <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> and <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> properties are used to compute the <a data-link-type=dfn href=#perspective-matrix title="perspective matrix">perspective matrix</a>, as described above.
<p class=note>Note: While the <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a> for SVG elements without an associated CSS layout box incorporate the result of the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> and <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> properties on descendants, the results of the <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> and <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> properties are not taken into account.
<h2 class="heading settled heading" data-level=11 id=perspective-origin-property><span class=secno>11 </span><span class=content>The <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> Property</span><a class=self-link href=#perspective-origin-property></a></h2>
<p>The <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> property establishes the origin for the <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> property. It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element.
<table class=propdef><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-perspective-origin>perspective-origin<a class=self-link href=#propdef-perspective-origin></a></dfn><tr><th>Value:<td> [ left | center | right | top | bottom | <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="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> ]<br> |<br> [ left | center | right | <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="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> ]<br> [ top | center | bottom | <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="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> ]<br> |<br> [ center | [ left | right ] ] && [ center | [ top | bottom ] ]<tr><th>Initial:<td>50% 50%<tr><th>Applies to:<td><a data-link-type=dfn href=#transformable-element title="transformable elements">transformable elements</a><tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>For <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> the absolute value, otherwise a percentage.<tr><th>Percentages:<td>refer to the size of the <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a><tr><th>Animatable:<td>as <a href=http://dev.w3.org/csswg/css3-transitions/#animtype-simple-list>simple list</a> of <a href=http://dev.w3.org/csswg/css3-transitions/#animtype-lpcalc>length, percentage, or calc</a></table>
<p>The values of the <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a> and <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> properties are used to compute the <a data-link-type=dfn href=#perspective-matrix title="perspective matrix">perspective matrix</a>, as described above.
<p>If only one value is specified, the second value is assumed to be <a class=css-code data-link-for=perspective-origin data-link-type=value href=#valuedef-center title=center>center</a>.
<p>If at least one of the two values is not a keyword, then the first value represents the horizontal position (or offset) and the second represents the vertical position (or offset).
<p>The values for <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> represent an offset of the perspective origin from the top left corner of the <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>.
<dl data-dfn-for=perspective-origin data-dfn-type=value>
<dt><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>
<dd><p>A percentage for the horizontal perspctive offset is relative to the width of the
<a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>.
A percentage for the vertical offset is relative to height of the
<a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>. The value for the horizontal
and vertical offset represent an offset from the top left corner of the
<a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>.
</p>
</dd>
<dt><a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a></dt>
<dd>
<p>A length value gives a fixed length as the offset. The value for the horizontal
and vertical offset represent an offset from the top left corner of the
<a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>.
</dd>
<dt><dfn class=css-code data-dfn-for=perspective-origin data-dfn-type=value data-export="" id=valuedef-top>top<a class=self-link href=#valuedef-top></a></dfn></dt>
<dd>Computes to <span class=css data-link-type=maybe title=0%>0%</span> for the vertical position.</dd>
<dt><dfn class=css-code data-dfn-for=perspective-origin data-dfn-type=value data-export="" id=valuedef-right>right<a class=self-link href=#valuedef-right></a></dfn></dt>
<dd>Computes to <span class=css data-link-type=maybe title=100%>100%</span> for the horizontal position.</dd>
<dt><dfn class=css-code data-dfn-for=perspective-origin data-dfn-type=value data-export="" id=valuedef-bottom>bottom<a class=self-link href=#valuedef-bottom></a></dfn></dt>
<dd>Computes to <span class=css data-link-type=maybe title=100%>100%</span> for the vertical position.</dd>
<dt><dfn class=css-code data-dfn-for=perspective-origin data-dfn-type=value data-export="" id=valuedef-left>left<a class=self-link href=#valuedef-left></a></dfn></dt>
<dd>Computes to <span class=css data-link-type=maybe title=0%>0%</span> for the horizontal position.</dd>
<dt><dfn class=css-code data-dfn-for=perspective-origin data-dfn-type=value data-export="" id=valuedef-center>center<a class=self-link href=#valuedef-center></a></dfn></dt>
<dd>
Computes to <span class=css data-link-type=maybe title=50%>50%</span> (<span class=css data-link-type=maybe title="left 50%">left 50%</span>) for the horizontal position if the horizontal position is not otherwise specified, or <span class=css data-link-type=maybe title=50%>50%</span> (<span class=css data-link-type=maybe title="top 50%">top 50%</span>) for the vertical position if it is.
</dd>
</dl>
<p>The <a href=http://www.w3.org/TR/cssom/#resolved-value>resolved value</a> of <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a> is the <a href=http://www.w3.org/TR/CSS21/cascade.html#used-value>used value</a> (i.e., percentages are resolved to absolute lengths).
<h2 class="heading settled heading" data-level=12 id=backface-visibility-property><span class=secno>12 </span><span class=content>The <a class=property data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility</a> Property</span><a class=self-link href=#backface-visibility-property></a></h2>
<p>The <a class=property data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility</a> property determines whether or not the "back" side of a transformed element is visible when facing the viewer. With an identity transform, the front side of an element faces the viewer. Applying a rotation about Y of 180° (for instance) would cause the back side of the element to face the viewer.
<p class=note>Note: This property is useful when you place two elements back-to-back, as you would to create a playing card. Without this property, the front and back elements could switch places at times during an animation to flip the card. Another example is creating a box out of 6 elements, but where you want to see the inside faces of the box. This is useful when creating the backdrop for a 3 dimensional stage.
<table class=propdef><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-backface-visibility>backface-visibility<a class=self-link href=#propdef-backface-visibility></a></dfn><tr><th>Value:<td>visible | hidden<tr><th>Initial:<td>visible<tr><th>Applies to:<td><a data-link-type=dfn href=#transformable-element title="transformable elements">transformable elements</a><tr><th>Inherited:<td>no<tr><th>Media:<td>visual<tr><th>Computed value:<td>Same as specified value.<tr><th>Percentages:<td>N/A<tr><th>Animatable:<td>no</table>
<p>The visibility of an element with <a class=css data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility: hidden</a> is determined as follows:
<ol>
<li>
For an element in a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a>, compute its <var> accumulated 3D transformation matrix</var>. For an element not in a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a>, compute its <a data-link-type=dfn href=#transformation-matrix title="transformation matrix">transformation matrix</a>.
</li>
<li>
If the component of the matrix in row 3, column 3 is negative, then the element should be hidden. Otherwise it is visible.
</li>
</ol>
<p class=issue id=issue-1b6023b0><a class=self-link href=#issue-1b6023b0></a>Backface-visibility cannot be tested by only looking at m33. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=23014">Bug 23014</a>.</p>
<p class=note>Note: The reasoning for this definition is as follows. Assume elements are rectangles in the <var>x</var>–<var>y</var> plane with infinitesimal thickness. The front of the untransformed element has coordinates like (<var>x</var>, <var>y</var>, <var>ε</var>), and the back is (<var>x</var>, <var>y</var>, −<var>ε</var>), for some very small <var>ε</var>. We want to know if after the transformation, the front of the element is closer to the viewer than the back (higher <var>z</var>-value) or further away. The <var>z</var>-coordinate of the front will be m<sub>13</sub><var>x</var> + m<sub>23</sub><var>y</var> + m<sub>33</sub><var>ε</var> + m<sub>43</sub>, before accounting for perspective, and the back will be m<sub>13</sub><var>x</var> + m<sub>23</sub><var>y</var> − m<sub>33</sub><var>ε</var> + m<sub>43</sub>. The first quantity is greater than the second if and only if m<sub>33</sub> > 0. (If it equals zero, the front and back are equally close to the viewer. This probably means something like a 90-degree rotation, which makes the element invisible anyway, so we don’t really care whether it vanishes.)
<h2 class="heading settled heading" data-level=13 id=svg-transform><span class=secno>13 </span><span class=content>The SVG <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> Attribute</span><a class=self-link href=#svg-transform></a></h2>
<p>The SVG 1.1 specification did not specify the attributes <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a>, <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElementGradientTransformAttribute title=gradienttransform>gradientTransform</a> or <a class=attr-name href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElementPatternTransformAttribute>‘patternTransform‘</a> as <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/intro.html#TermPresentationAttribute>presentation attributes</a> <a data-biblio-type=normative data-link-type=biblio href=#svg11 title=svg11>[SVG11]</a>. In order to improve the integration of SVG and HTML, this specification makes these SVG attributes presentation attributes and makes the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> property one that applies to <a data-link-type=dfn href=#transformable-element title="transformable elements">transformable elements</a> in the SVG namespace.
<p>This specification will also introduce the new presentation attributes <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a>, <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a>, <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a>, <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a> and <a class=property data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility</a>.
<p>Values on new introduced presentation attributes get parsed following the syntax rules on <a href=#svg-data-types>SVG Data Types</a> <a data-biblio-type=normative data-link-type=biblio href=#svg11 title=svg11>[SVG11]</a>.
<h3 class="heading settled heading" data-level=13.1 id=transform-attribute-specificity><span class=secno>13.1 </span><span class=content>
SVG <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> attribute specificity
</span><a class=self-link href=#transform-attribute-specificity></a></h3>
<p>Since the previously named SVG attributes become presentation attributes, their participation in the CSS cascade is determined by the specificity of <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/intro.html#TermPresentationAttribute>presentation attributes</a> in the SVG specification.
<div class=example>
<p>
This example shows the combination of the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> style property and the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> presentation attribute.
</p>
<pre><svg xmlns="http://www.w3.org/2000/svg">
<style>
.container {
transform: translate(100px, 100px);
}
</style>
<g class="container" transform="translate(200 200)">
<rect width="100" height="100" fill="blue" />
</g>
</svg></pre>
<div class=figure>
<img alt="Translated SVG container element." height=240 src=examples/svg-translate1.svg width=470>
</div>
<p>
Because of the participation to the CSS cascade, the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> style property overrides the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> presentation attribute. Therefore the container gets translated by <span class=css data-link-type=maybe title=100px>100px</span> in both the horizontal and the vertical directions, instead of <span class=css data-link-type=maybe title=200px>200px</span>.
</p>
</div>
<h3 class="heading settled heading" data-level=13.2 id=svg-syntax><span class=secno>13.2 </span><span class=content>Syntax of the SVG <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> attribute</span><a class=self-link href=#svg-syntax></a></h3>
<p>To provide backwards compatibility, the syntax of the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> presentation attribute differs from the syntax of the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> style property as shown in the example above. However, the syntax used for the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> style property can be used for a <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> presentation attribute value. Authors are advised to follow the rules of CSS Values and Units Module <a data-biblio-type=normative data-link-type=biblio href=#css3val title=css3val>[CSS3VAL]</a>. Therefore an author should write ''transform="translate(200px, 200px)"<span class=css data-link-type=maybe title=" instead of "> instead of </span>transform="translate (200 200)"<span class=css data-link-type=maybe title=" because the second example with the spaces before the "> because the second example with the spaces before the </span>('', the missing comma between the arguments and the values without the explicit unit notation would be valid for the attribute only.
<h4 class="heading settled heading" data-level=13.2.1 id=svg-transform-list><span class=secno>13.2.1 </span><span class=content>Transform List</span><a class=self-link href=#svg-transform-list></a></h4>
<p>The value for the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> attribute consists of a transform list with zero or more transform functions using <a href=#svg-functional-notation>functional notation</a>. If the transform list consists of more than one transform function, these functions are separated by optional whitespace, an optional comma (<span class=css data-link-type=maybe title=,>,</span>) and optional whitespace. The transform list can have optional whitespace characters before and after the list.
<h4 class="heading settled heading" data-level=13.2.2 id=svg-functional-notation><span class=secno>13.2.2 </span><span class=content>Functional Notation</span><a class=self-link href=#svg-functional-notation></a></h4>
<p>The syntax starts with the name of the function followed by optional whitespace characters followed by a left parenthesis followed by optional whitespace followed by the argument(s) to the notation followed by optional whitespace followed by a right parenthesis. If a function takes more than one argument, the arguments are either separated by a comma (<span class=css data-link-type=maybe title=,>,</span>) with optional whitespace characters before and after the comma, or by one or more whitespace characters.
<h4 class="heading settled heading" data-level=13.2.3 id=svg-data-types><span class=secno>13.2.3 </span><span class=content>SVG Data Types</span><a class=self-link href=#svg-data-types></a></h4>
<p>Arguments on all new introduced presentation attributes consist of data types in the sense of CSS Values and Units Module <a data-biblio-type=normative data-link-type=biblio href=#css3val title=css3val>[CSS3VAL]</a>. The definitions of data types in CSS Values and Units Module are enhanced as follows:
<h5 class="heading settled heading" data-level=13.2.3.1 id=svg-transform-value><span class=secno>13.2.3.1 </span><span class=content>
The <a class="production css-code" data-link-type=type href=#typedef-translation-value title="<translation-value>"><translation-value></a> and <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> type
</span><a class=self-link href=#svg-transform-value></a></h5>
<p>A <dfn class=css-code data-dfn-type=type data-export="" id=typedef-translation-value><translation-value><a class=self-link href=#typedef-translation-value></a></dfn> or <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#length-value title="<length>"><length></a> can be a <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#number-value title="<number>"><number></a> without an unit identifier. In this case the <a href=#svg-number><em>number</em></a> gets interpreted as "user unit". A user unit in the the <a href=http://www.w3.org/TR/2003/REC-SVG11-20030114/coords.html#InitialCoordinateSystem>initial coordinate system</a> is equivalent to the parent environment’s notion of a pixel unit.
<h5 class="heading settled heading" data-level=13.2.3.2 id=svg-angle><span class=secno>13.2.3.2 </span><span class=content>The <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#angle-value title="<angle>"><angle></a> type</span><a class=self-link href=#svg-angle></a></h5>
<p>An angle can be a <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#number-value title="<number>"><number></a> without an unit identifier. In this case the <a href=#svg-number><em>number</em></a> gets interpreted as a value in degrees.
<h5 class="heading settled heading" data-level=13.2.3.3 id=svg-number><span class=secno>13.2.3.3 </span><span class=content>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> type</span><a class=self-link href=#svg-number></a></h5>
<p>SVG supports scientific notations for numbers. Therefore a <em>number</em> gets parsed like described in SVG <a href=http://www.w3.org/TR/SVG/types.html#DataTypeNumber>Basic data types</a> for SVG attributes.
<h3 class="heading settled heading" data-level=13.3 id=svg-gradient-transform-pattern-transform><span class=secno>13.3 </span><span class=content>
The SVG <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElementGradientTransformAttribute title=gradienttransform>gradientTransform</a> and <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElementPatternTransformAttribute title=patterntransform>patternTransform</a> attributes
</span><a class=self-link href=#svg-gradient-transform-pattern-transform></a></h3>
<p>SVG specifies the attributes <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElementGradientTransformAttribute title=gradienttransform>gradientTransform</a> and <a class=attr-name href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElementPatternTransformAttribute>‘patternTransform‘</a>. This specification makes both attributes presentation attributes. Both attributes use the same <a href=#svg-syntax>syntax</a> as the SVG <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> attribute. This specification does not introduce corresponding CSS style properties. Both, the <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElementGradientTransformAttribute title=gradienttransform>gradientTransform</a> and the <a class=attr-name href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElementPatternTransformAttribute>‘patternTransform‘</a> attribute, are presentation attributes for the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> property.
<h3 class="heading settled heading" data-level=13.4 id=svg-transform-functions><span class=secno>13.4 </span><span class=content>
SVG transform functions
</span><a class=self-link href=#svg-transform-functions></a></h3>
<p>For backwards compatibility with existing SVG content, this specification supports all transform functions defined by <a href=http://www.w3.org/TR/SVG/coords.html#TransformAttribute>The ‘transform’ attribute</a> in <a data-biblio-type=informative data-link-type=biblio href=#svg11 title=svg11>[SVG11]</a>. Therefore the two-dimensional transform function <span class=css data-link-type=maybe title="rotate(<angle>)">rotate(<angle>)</span> is extended as follows:
<dl>
<dt id=rotate-three-function><a class=self-link href=#rotate-three-function></a>
<pre class=prod><a data-link-type=functionish href=#funcdef-rotate title=rotate()>rotate()</a> = rotate( <a class="production css-code" data-link-type=type href=http://dev.w3.org/csswg/css-values-3/#angle-value title="<angle>"><angle></a> [, <a class="production css-code" data-link-type=type href=#typedef-translation-value title="<translation-value>"><translation-value></a>, <a class="production css-code" data-link-type=type href=#typedef-translation-value title="<translation-value>"><translation-value></a>]? )</pre> </dt>
<dd>
specifies a <a href=#RotateDefined>2D rotation</a> by the angle specified in the parameter about the origin of the element, as defined by the <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> property. If the optional translation values are specified, the transform origin is translated by that amount (using the current transformation matrix) for the duration of the rotate operation. For example <span class=css data-link-type=maybe title="rotate(90deg, 100px, 100px)">rotate(90deg, 100px, 100px)</span> would cause elements to appear rotated one-quarter of a turn in the clockwise direction after a translation of the transform-origin of 100 pixel in the horizontal and vertical directions.
</dd>
</dl>
<p>User agents are just required to support the two optional arguments for translation on elements in the SVG namespace.
<h3 class="heading settled heading" data-level=13.5 id=svg-three-dimensional-functions><span class=secno>13.5 </span><span class=content>SVG and 3D transform functions</span><a class=self-link href=#svg-three-dimensional-functions></a></h3>
<p>This specification explicitly requires three-dimensional transform functions to apply to the <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/intro.html#TermContainerElement>container elements</a>: <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/linking.html#AElement><code class=element-name><a></code></a>, <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/struct.html#GElement><code class=element-name><g></code></a>, <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/struct.html#SVGElement><code class=element-name><svg></code></a>, all <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/intro.html#TermGraphicsElement>graphics elements</a>, all <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/intro.html#TermGraphicsReferencingElement>graphics referencing elements</a> and the SVG <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/extend.html#ForeignObjectElement><code class=element-name><foreignObject></code></a> element.
<p>Three-dimensional transform functions and the properties <a class=property data-link-type=propdesc href=#propdef-perspective title=perspective>perspective</a>, <a class=property data-link-type=propdesc href=#propdef-perspective-origin title=perspective-origin>perspective-origin</a>, <a class=property data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style</a> and <a class=property data-link-type=propdesc href=#propdef-backface-visibility title=backface-visibility>backface-visibility</a> can not be used for the elements: <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/masking.html#ClipPathElement><code class=element-name><clipPath></code></a>, <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElement><code class=element-name><linearGradient></code></a>, <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#RadialGradientElement><code class=element-name><radialGradient></code></a> and <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElement><code class=element-name><pattern></code></a>. If a transform list includes a three-dimensional transform function, the complete transform list must be ignored. The values of every previously named property must be ignored. <var>Transformable elements</var> that are contained by one of these elements can have three-dimensional transform functions. The <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/masking.html#ClipPathElement><code class=element-name><clipPath></code></a>, <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/masking.html#MaskElement><code class=element-name><mask></code></a>, <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElement><code class=element-name><pattern></code></a> elements require the user agent to create a flattened representation of the descendant elements before they can be applied, and therefore override the behavior of <a class=css data-link-type=propdesc href=#propdef-transform-style title=transform-style>transform-style: preserve-3d</a>.
<p>If the <a class=property data-link-type=propdesc href=https://svgwg.org/svg2-draft/painting.html#VectorEffectProperty title=vector-effect>vector-effect</a> property is set to <span class=css data-link-type=maybe title=non-scaling-stroke>non-scaling-stroke</span> and an object is within a <a data-link-type=dfn href=#3d-rendering-context title="3d rendering context">3D rendering context</a> the property has no affect on stroking the object.
<h3 class="heading settled heading" data-level=13.6 id=svg-user-coordinate-space><span class=secno>13.6 </span><span class=content>User coordinate space</span><a class=self-link href=#svg-user-coordinate-space></a></h3>
<p>For the <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElement><code class=element-name><pattern></code></a>, <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElement><code class=element-name><linearGradient></code></a>, <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#RadialGradientElement><code class=element-name><radialGradient></code></a> and <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/masking.html#ClipPathElement><code class=element-name><clipPath></code></a> elements the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a>, <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElementPatternTransformAttribute title=patterntransform>patternTransform</a>, <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElementGradientTransformAttribute title=gradienttransform>gradientTransform</a> presentation attributes represents values in the current user coordinate system in place at the time when these elements are referenced (i.e., the user coordinate system for the element referencing the <a href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElement><code class=element-name><pattern></code></a> element via a <a class=property data-link-type=propdesc href=http://www.w3.org/TR/SVG/painting.html#FillProperty title=fill>fill</a> or <a class=property data-link-type=propdesc href=http://www.w3.org/TR/SVG/painting.html#StrokeProperty title=stroke>stroke</a> property). Percentage values are relative to the <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a> of the referencing element.
<p>In particular the <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElementPatternUnitsAttribute title=patternunits>patternUnits</a>, <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElementGradientUnitsAttribute title=gradientunits>gradientUnits</a> and <a class=attr-name data-link-type=maybe href=http://www.w3.org/TR/2011/REC-SVG11-20110816/masking.html#MaskElementMaskUnitsAttribute title=maskunits>maskUnits</a> attributes don’t affect the user coordinate system used for transformations <a data-biblio-type=informative data-link-type=biblio href=#svg11 title=svg11>[SVG11]</a>.
<p>For all other <a data-link-type=dfn href=#transformable-element title="transformable elements">transformable elements</a> the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> presentation attribute represents values in the current user coordinate system of the parent. All percentage values of the <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> presentation attribute are relative to the element’s <a data-link-type=dfn href=#bounding-box title="bounding box">bounding box</a>.
<div class=example>
<p>
The <a class=property data-link-type=propdesc href=#propdef-transform-origin title=transform-origin>transform-origin</a> property on the pattern in the following example specifies a <span class=css data-link-type=maybe title=50%>50%</span> translation of the origin in the horizontal and vertical dimension. The <a class=property data-link-type=propdesc href=#propdef-transform title=transform>transform</a> property specifies a translation as well, but in absolute lengths.
</p>
<pre><svg xmlns="http://www.w3.org/2000/svg">
<style>
pattern {
transform: rotate(45deg);
transform-origin: 50% 50%;
}
</style>
<defs>
<pattern id="pattern-1">
<rect id="rect1" width="100" height="100" fill="blue" />
</pattern>