forked from w3c/csswg-drafts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOverview.html
4177 lines (4126 loc) · 301 KB
/
Overview.html
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>
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<meta content="WD" name="w3c-status">
<link href="default.css" rel="stylesheet" type="text/css">
<meta content="Bikeshed version 0da7328bb90ef81993146377e4e0fed236969c4c" name="generator">
<link href="https://www.w3.org/TR/css-transforms-1/" rel="canonical">
<meta content="7b7bd57458d7f21d2afc94dcdec49c97a9b95938" name="document-revision">
<style 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>
<style>/* style-md-lists */
/* This is a weird hack for me not yet following the commonmark spec
regarding paragraph and lists. */
[data-md] > :first-child {
margin-top: 0;
}
[data-md] > :last-child {
margin-bottom: 0;
}</style>
<style>/* style-selflinks */
.heading, .issue, .note, .example, li, dt {
position: relative;
}
a.self-link {
position: absolute;
top: 0;
left: calc(-1 * (3.5rem - 26px));
width: calc(3.5rem - 26px);
height: 2em;
text-align: center;
border: none;
transition: opacity .2s;
opacity: .5;
}
a.self-link:hover {
opacity: 1;
}
.heading > a.self-link {
font-size: 83%;
}
li > a.self-link {
left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
top: auto;
left: auto;
opacity: 0;
width: 1.5em;
height: 1.5em;
background: gray;
color: white;
font-style: normal;
transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
opacity: 1;
}
dfn > a.self-link:hover {
color: black;
}
a.self-link::before { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before { content: "#"; }</style>
<style>/* style-counters */
body {
counter-reset: example figure issue;
}
.issue {
counter-increment: issue;
}
.issue:not(.no-marker)::before {
content: "Issue " counter(issue);
}
.example {
counter-increment: example;
}
.example:not(.no-marker)::before {
content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
content: "Invalid Example" counter(example);
}
figcaption {
counter-increment: figure;
}
figcaption:not(.no-marker)::before {
content: "Figure " counter(figure) " ";
}</style>
<style>/* style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
color: #005a9c;
font-size: inherit;
font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
content: "‘";
}
.css::after, .property::after, .descriptor::after {
content: "’";
}
.property, .descriptor {
/* Don't wrap property and descriptor names */
white-space: nowrap;
}
.type { /* CSS value <type> */
font-style: italic;
}
pre .property::before, pre .property::after {
content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
content: "’";
}
[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
content: "";
}
[data-link-type=element],
[data-link-type=element-attr] {
font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after { content: ">" }
[data-link-type=biblio] {
white-space: pre;
}</style>
<style>/* style-dfn-panel */
.dfn-panel {
position: absolute;
z-index: 35;
height: auto;
width: -webkit-fit-content;
width: fit-content;
max-width: 300px;
max-height: 500px;
overflow: auto;
padding: 0.5em 0.75em;
font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
background: #DDDDDD;
color: black;
border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
display: inline-block;
position: fixed;
left: .5em;
bottom: 2em;
margin: 0 auto;
max-width: calc(100vw - 1.5em - .4em - .5em);
max-height: 30vh;
}
.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-railroad */
svg.railroad-diagram{background-color:hsl(30,20%,95%);}svg.railroad-diagram path{stroke-width:3px;stroke:black;fill:rgba(0,0,0,0);}svg.railroad-diagram text{font:bold 14px monospace;text-anchor:middle;}svg.railroad-diagram text.label{text-anchor:start;}svg.railroad-diagram text.comment{font:italic 12px monospace;}svg.railroad-diagram rect{stroke-width:3px;stroke:black;fill:hsl(120,100%,90%);}</style>
<style>/* style-syntax-highlighting */
.highlight:not(.idl) { background: hsl(24, 20%, 95%); }
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
c-[a] { color: #990055 } /* Keyword.Declaration */
c-[b] { color: #990055 } /* Keyword.Type */
c-[c] { color: #708090 } /* Comment */
c-[d] { color: #708090 } /* Comment.Multiline */
c-[e] { color: #0077aa } /* Name.Attribute */
c-[f] { color: #669900 } /* Name.Tag */
c-[g] { color: #222222 } /* Name.Variable */
c-[k] { color: #990055 } /* Keyword */
c-[l] { color: #000000 } /* Literal */
c-[m] { color: #000000 } /* Literal.Number */
c-[n] { color: #0077aa } /* Name */
c-[o] { color: #999999 } /* Operator */
c-[p] { color: #999999 } /* Punctuation */
c-[s] { color: #a67f59 } /* Literal.String */
c-[t] { color: #a67f59 } /* Literal.String.Single */
c-[u] { color: #a67f59 } /* Literal.String.Double */
c-[cp] { color: #708090 } /* Comment.Preproc */
c-[c1] { color: #708090 } /* Comment.Single */
c-[cs] { color: #708090 } /* Comment.Special */
c-[kc] { color: #990055 } /* Keyword.Constant */
c-[kn] { color: #990055 } /* Keyword.Namespace */
c-[kp] { color: #990055 } /* Keyword.Pseudo */
c-[kr] { color: #990055 } /* Keyword.Reserved */
c-[ld] { color: #000000 } /* Literal.Date */
c-[nc] { color: #0077aa } /* Name.Class */
c-[no] { color: #0077aa } /* Name.Constant */
c-[nd] { color: #0077aa } /* Name.Decorator */
c-[ni] { color: #0077aa } /* Name.Entity */
c-[ne] { color: #0077aa } /* Name.Exception */
c-[nf] { color: #0077aa } /* Name.Function */
c-[nl] { color: #0077aa } /* Name.Label */
c-[nn] { color: #0077aa } /* Name.Namespace */
c-[py] { color: #0077aa } /* Name.Property */
c-[ow] { color: #999999 } /* Operator.Word */
c-[mb] { color: #000000 } /* Literal.Number.Bin */
c-[mf] { color: #000000 } /* Literal.Number.Float */
c-[mh] { color: #000000 } /* Literal.Number.Hex */
c-[mi] { color: #000000 } /* Literal.Number.Integer */
c-[mo] { color: #000000 } /* Literal.Number.Oct */
c-[sb] { color: #a67f59 } /* Literal.String.Backtick */
c-[sc] { color: #a67f59 } /* Literal.String.Char */
c-[sd] { color: #a67f59 } /* Literal.String.Doc */
c-[se] { color: #a67f59 } /* Literal.String.Escape */
c-[sh] { color: #a67f59 } /* Literal.String.Heredoc */
c-[si] { color: #a67f59 } /* Literal.String.Interpol */
c-[sx] { color: #a67f59 } /* Literal.String.Other */
c-[sr] { color: #a67f59 } /* Literal.String.Regex */
c-[ss] { color: #a67f59 } /* Literal.String.Symbol */
c-[vc] { color: #0077aa } /* Name.Variable.Class */
c-[vg] { color: #0077aa } /* Name.Variable.Global */
c-[vi] { color: #0077aa } /* Name.Variable.Instance */
c-[il] { color: #000000 } /* Literal.Number.Integer.Long */
</style>
<link href="https://www.w3.org/StyleSheets/TR/2016/W3C-WD" rel="stylesheet" type="text/css">
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" 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" id="subtitle"><span class="content">W3C Working Draft, <time class="dt-updated" datetime="2018-11-24">24 November 2018</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="https://www.w3.org/TR/2018/WD-css-transforms-1-20181124/">https://www.w3.org/TR/2018/WD-css-transforms-1-20181124/</a>
<dt>Latest published version:
<dd><a href="https://www.w3.org/TR/css-transforms-1/">https://www.w3.org/TR/css-transforms-1/</a>
<dt>Editor's Draft:
<dd><a href="https://drafts.csswg.org/css-transforms/">https://drafts.csswg.org/css-transforms/</a>
<dt>Previous Versions:
<dd><a href="https://www.w3.org/TR/2017/WD-css-transforms-1-20171130/" rel="prev">https://www.w3.org/TR/2017/WD-css-transforms-1-20171130/</a>
<dd><a href="https://www.w3.org/TR/2013/WD-css-transforms-1-20131126/" rel="prev">https://www.w3.org/TR/2013/WD-css-transforms-1-20131126/</a>
<dd><a href="https://www.w3.org/TR/2012/WD-css3-transforms-20120911/" rel="prev">https://www.w3.org/TR/2012/WD-css3-transforms-20120911/</a>
<dd><a href="https://www.w3.org/TR/2012/WD-css3-transforms-20120403/" rel="prev">https://www.w3.org/TR/2012/WD-css3-transforms-20120403/</a>
<dt>Test Suite:
<dd><a href="http://test.csswg.org/suites/css-transforms-1_dev/nightly-unstable/">http://test.csswg.org/suites/css-transforms-1_dev/nightly-unstable/</a>
<dt class="editor">Editors:
<dd class="editor p-author h-card vcard" data-editor-id="44066"><a class="p-name fn u-email email" href="mailto:simon.fraser@apple.com">Simon Fraser</a> (<a class="p-org org" href="http://www.apple.com/">Apple Inc</a>)
<dd class="editor p-author h-card vcard" data-editor-id="42080"><a class="p-name fn u-email email" href="mailto:dino@apple.com">Dean Jackson</a> (<a class="p-org org" href="http://www.apple.com/">Apple Inc</a>)
<dd class="editor p-author h-card vcard" data-editor-id="40614"><a class="p-name fn u-email email" href="mailto:eoconnor@apple.com">Theresa O'Connor</a> (<a class="p-org org" href="http://www.apple.com/">Apple Inc</a>)
<dd class="editor p-author h-card vcard" data-editor-id="51803"><a class="p-name fn u-email email" href="mailto:dschulze@adobe.com">Dirk Schulze</a> (<a class="p-org org" href="http://www.adobe.com/">Adobe Inc</a>)
<dt class="editor">Former Editors:
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:hyatt@apple.com">David Hyatt</a> (<a class="p-org org" href="http://www.apple.com/">Apple Inc</a>)
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:cmarrin@apple.com">Chris Marrin</a> (<a class="p-org org" href="http://www.apple.com/">Apple Inc</a>)
<dd class="editor p-author h-card vcard"><a class="p-name fn u-email email" href="mailto:ayg@aryeh.name">Aryeh Gregor</a> (<a class="p-org org" href="http://www.mozilla.org/">Mozilla</a>)
<dt>Issue Tracking:
<dd><a href="https://github.com/w3c/csswg-drafts/labels/css-transforms-1">GitHub Issues</a>
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2018 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. </p>
<hr title="Separator for header">
</div>
<div class="p-summary" data-fill-with="abstract">
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<p>CSS transforms allows elements styled with CSS to be transformed in two-dimensional space. This specification is the convergence of the <a href="https://www.w3.org/TR/2009/WD-css3-2d-transforms-20090320/">CSS 2D Transforms</a> and <a href="https://www.w3.org/TR/2009/WD-SVG-Transforms-20090320/">SVG transforms</a> specifications.</p>
</div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p> <em>This section describes the status of this document at the time of
its publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical report
can be found in the <a href="https://www.w3.org/TR/">W3C technical reports
index at https://www.w3.org/TR/.</a></em> </p>
<p> Publication as a Working Draft does not imply endorsement by the W3C
Membership. This is a draft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to cite this
document as other than work in progress. </p>
<p> <a href="https://github.com/w3c/csswg-drafts/issues">GitHub Issues</a> are preferred for discussion of this specification.
When filing an issue, please put the text “css-transforms” in the title,
preferably like this:
“[css-transforms] <i>…summary of comment…</i>”.
All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>,
and there is also a <a href="https://lists.w3.org/Archives/Public/www-style/">historical archive</a>. </p>
<p> This document was published by the <a href="https://www.w3.org/Style/CSS/members">CSS Working Group</a> and the <a href="https://www.w3.org/Graphics/SVG/WG/">SVG Working Group</a>. </p>
<p> This document was produced by groups operating under
the <a href="https://www.w3.org/Consortium/Patent-Policy/">W3C Patent Policy</a>.
W3C maintains a <a href="https://www.w3.org/2004/01/pp-impl/32061/status" rel="disclosure">public list of any patent disclosures (CSS)</a> and a <a href="https://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 include instructions for disclosing a patent.
An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
<p>This document is governed by the <a href="https://www.w3.org/2018/Process-20180201/" id="w3c_process_revision">1 February 2018 W3C Process Document</a>. </p>
<p></p>
</div>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li>
<a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
<ol class="toc">
<li><a href="#module-interactions"><span class="secno">1.1</span> <span class="content">Module Interactions</span></a>
<li><a href="#css-values"><span class="secno">1.2</span> <span class="content">CSS Values</span></a>
</ol>
<li><a href="#terminology"><span class="secno">2</span> <span class="content">Terminology</span></a>
<li><a href="#transform-rendering"><span class="secno">3</span> <span class="content">The Transform Rendering Model</span></a>
<li>
<a href="#transform-property"><span class="secno">4</span> <span class="content">The <span class="property">transform</span> Property</span></a>
<ol class="toc">
<li><a href="#serialization-of-transform-functions"><span class="secno">4.1</span> <span class="content">Serialization of <span class="production"><transform-function></span>s</span></a>
<li><a href="#serialization-of-the-computed-value"><span class="secno">4.2</span> <span class="content">Serialization of the computed value of <span class="production"><transform-list></span></span></a>
</ol>
<li><a href="#transform-origin-property"><span class="secno">5</span> <span class="content">The <span class="property">transform-origin</span> Property</span></a>
<li><a href="#transform-box"><span class="secno">6</span> <span class="content">Transform reference box: the <span class="property">transform-box</span> property</span></a>
<li>
<a href="#svg-transform"><span class="secno">7</span> <span class="content">The SVG <span>transform</span> Attribute</span></a>
<ol class="toc">
<li><a href="#transform-attribute-specificity"><span class="secno">7.1</span> <span class="content">SVG presentation attributes</span></a>
<li><a href="#svg-syntax"><span class="secno">7.2</span> <span class="content">Syntax of the SVG <span>transform</span> attribute</span></a>
<li><a href="#svg-transform-functions"><span class="secno">7.3</span> <span class="content">SVG transform functions</span></a>
<li><a href="#svg-user-coordinate-space"><span class="secno">7.4</span> <span class="content">User coordinate space</span></a>
<li><a href="#transform-attribute-dom"><span class="secno">7.5</span> <span class="content">SVG DOM interface for the <span>transform</span> attribute</span></a>
</ol>
<li>
<a href="#svg-animation"><span class="secno">8</span> <span class="content">SVG Animation</span></a>
<ol class="toc">
<li><a href="#svg-animate-element"><span class="secno">8.1</span> <span class="content">The <code><span>animate</span></code> and <code><span>set</span></code> element</span></a>
<li><a href="#neutral-element"><span class="secno">8.2</span> <span class="content">Neutral element for addition</span></a>
<li><a href="#svg-attribute-name"><span class="secno">8.3</span> <span class="content">The SVG '<span>attributeName</span>' attribute</span></a>
</ol>
<li>
<a href="#transform-functions"><span class="secno">9</span> <span class="content">The Transform Functions</span></a>
<ol class="toc">
<li><a href="#two-d-transform-functions"><span class="secno">9.1</span> <span class="content">2D Transform Functions</span></a>
<li><a href="#transform-primitives"><span class="secno">9.2</span> <span class="content">Transform function primitives and derivatives</span></a>
</ol>
<li><a href="#transform-function-lists"><span class="secno">10</span> <span class="content">The Transform Function Lists</span></a>
<li><a href="#interpolation-of-transforms"><span class="secno">11</span> <span class="content">Interpolation of Transforms</span></a>
<li><a href="#interpolation-of-transform-functions"><span class="secno">12</span> <span class="content">Interpolation of primitives and derived transform functions</span></a>
<li>
<a href="#matrix-interpolation"><span class="secno">13</span> <span class="content">Interpolation of Matrices</span></a>
<ol class="toc">
<li><a href="#supporting-functions"><span class="secno">13.1</span> <span class="content">Supporting functions</span></a>
<li>
<a href="#interpolation-of-2d-matrices"><span class="secno">13.2</span> <span class="content">Interpolation of 2D matrices</span></a>
<ol class="toc">
<li><a href="#decomposing-a-2d-matrix"><span class="secno">13.2.1</span> <span class="content">Decomposing a 2D matrix</span></a>
<li><a href="#interpolation-of-decomposed-2d-matrix-values"><span class="secno">13.2.2</span> <span class="content"> Interpolation of decomposed 2D matrix values </span></a>
<li><a href="#recomposing-to-a-2d-matrix"><span class="secno">13.2.3</span> <span class="content">Recomposing to a 2D matrix</span></a>
</ol>
</ol>
<li><a href="#mathematical-description"><span class="secno">14</span> <span class="content">Mathematical Description of Transform Functions</span></a>
<li><a href="#priv-sec"><span class="secno">15</span> <span class="content">Privacy and Security Considerations</span></a>
<li><a href="#changes"><span class="secno"></span> <span class="content">Changes since last publication</span></a>
<li><a href="#acknowledgments"><span class="secno"></span> <span class="content">Acknowledgments</span></a>
<li>
<a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
<ol class="toc">
<li><a href="#conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a>
<li><a href="#conformance-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a>
<li>
<a href="#partial"><span class="secno"></span> <span class="content"> Partial implementations</span></a>
<ol class="toc">
<li><a href="#conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a>
</ol>
<li><a href="#testing"><span class="secno"></span> <span class="content"> Non-experimental implementations</span></a>
</ol>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ol>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
</ol>
<li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a>
</ol>
</nav>
<main>
<h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2>
<p><em>This section is not normative.</em></p>
<p>The CSS <a href="https://www.w3.org/TR/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>
<p>This coordinate space can be modified with the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform">transform</a> property. Using transform, elements can be translated, rotated and scaled.</p>
<h3 class="heading settled" data-level="1.1" id="module-interactions"><span class="secno">1.1. </span><span class="content">Module Interactions</span><a class="self-link" href="#module-interactions"></a></h3>
<p>This module 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="https://www.w3.org/TR/CSS2/visuren.html">visual formatting model</a> from <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>. Some values of these properties result in the creation of a <a href="https://www.w3.org/TR/CSS2/visuren.html#containing-block">containing block</a>, and/or the creation of a <a data-link-type="dfn" href="https://www.w3.org/TR/css3-positioning/#stacking-context" id="ref-for-stacking-context">stacking context</a>.</p>
<p>Transforms affect the rendering of backgrounds on elements with a value of <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-background/#valdef-background-attachment-fixed" id="ref-for-valdef-background-attachment-fixed">fixed</a> for the <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css3-background/#propdef-background-attachment" id="ref-for-propdef-background-attachment">background-attachment</a> property, which is specified in <a data-link-type="biblio" href="#biblio-css3bg">[CSS3BG]</a>.</p>
<p>Transforms affect the client rectangles returned by the Element Interface Extensions <a href="https://www.w3.org/TR/cssom-view/#dom-element-getclientrects">getClientRects()</a> and <a href="https://www.w3.org/TR/cssom-view/#dom-element-getboundingclientrect">getBoundingClientRect()</a>, which are specified in <a data-link-type="biblio" href="#biblio-cssom-view">[CSSOM-VIEW]</a>.</p>
<p>Transforms affect the computation of the <a href="https://www.w3.org/TR/css-overflow-3/#scrollable-overflow-region">scrollable overflow region</a> as described by <a data-link-type="biblio" href="#biblio-css-overflow-3">[CSS-OVERFLOW-3]</a>.</p>
<h3 class="heading settled" data-level="1.2" id="css-values"><span class="secno">1.2. </span><span class="content">CSS Values</span><a class="self-link" href="#css-values"></a></h3>
<p>This specification follows the <a href="https://www.w3.org/TR/CSS21/about.html#property-defs">CSS property definition conventions</a> from <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>.
Value types not defined in this specification are defined in CSS Values & Units <a data-link-type="biblio" href="#biblio-css-values-3">[CSS-VALUES-3]</a>.
Other CSS modules may expand the definitions of these value types.</p>
<p>In addition to the property-specific values listed in their definitions,
all properties defined in this specification
also accept the <a data-link-type="dfn" href="https://www.w3.org/TR/css-values-4/#css-wide-keywords" id="ref-for-css-wide-keywords">CSS-wide keywords</a> keywords as their property value.
For readability they have not been repeated explicitly.</p>
<h2 class="heading settled" data-level="2" id="terminology"><span class="secno">2. </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.</p>
<div>
<dl>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="transformable-element">transformable element</dfn>
<dd data-md>
<p>A transformable element is an element in one of these categories:</p>
<ul>
<li data-md>
<p>all elements whose layout is governed by the CSS box model except for non-replaced inline boxes, table-column boxes, and table-column-group boxes <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>,</p>
<li data-md>
<p>all SVG <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/painting.html#TermPaintServerElement" id="ref-for-TermPaintServerElement">paint server elements</a>, the <a data-link-type="element" href="https://www.w3.org/TR/css-masking-1/#elementdef-clippath" id="ref-for-elementdef-clippath">clipPath</a> element and SVG <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/render.html#TermRenderableElement" id="ref-for-TermRenderableElement">renderable elements</a> with the exception of any descendant element of <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/text.html#TermTextContentElement" id="ref-for-TermTextContentElement">text content elements</a> <a data-link-type="biblio" href="#biblio-svg2">[SVG2]</a>.</p>
</ul>
<dt data-md><dfn data-dfn-type="dfn" data-export id="transformed-element">transformed element<a class="self-link" href="#transformed-element"></a></dfn>
<dd data-md>
<p>An element with a computed value other than <span class="css">none</span> for the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform①">transform</a> property.</p>
<dt data-md><dfn data-dfn-type="dfn" data-export id="user-coordinate-system">user coordinate system<a class="self-link" href="#user-coordinate-system"></a></dfn>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="local-coordinate-system">local coordinate system</dfn>
<dd data-md>
<p>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.
The current user coordinate system has its origin at the top-left of a <a data-link-type="dfn" href="#reference-box" id="ref-for-reference-box">reference box</a> specified by the <a class="property" data-link-type="propdesc" href="#propdef-transform-box" id="ref-for-propdef-transform-box">transform-box</a> property. Percentage values are relative to the dimension of this reference box. One unit equals one CSS pixel.</p>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="transformation-matrix">transformation matrix</dfn>
<dd data-md>
<p>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" id="ref-for-propdef-transform②">transform</a> and <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin">transform-origin</a> properties as described <a href="#transformation-matrix-computation">below</a>.</p>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="current-transformation-matrix">current transformation matrix</dfn> (CTM)
<dd data-md>
<p>A matrix that defines the mapping from the <a data-link-type="dfn" href="#local-coordinate-system" id="ref-for-local-coordinate-system">local coordinate system</a> into the <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/coords.html#TermViewportCoordinateSystem" id="ref-for-TermViewportCoordinateSystem">viewport coordinate system</a>.</p>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="2d-matrix">2D matrix</dfn>
<dd data-md>
<p>A 3x2 transformation matrix, or a 4x4 matrix 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">0</span> and m<sub>33</sub>, m<sub>44</sub> are equal to <span class="css">1</span>.</p>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="identity-transform-function">identity transform function</dfn>
<dd data-md>
<p>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">translate(0)</span>, <span class="css">translateX(0)</span>, <span class="css">translateY(0)</span>, <span class="css">scale(1)</span>, <span class="css">scaleX(1)</span>, <span class="css">scaleY(1)</span>, <span class="css">rotate(0)</span>, <span class="css">skew(0, 0)</span>, <span class="css">skewX(0)</span>, <span class="css">skewY(0)</span> and <span class="css">matrix(1, 0, 0, 1, 0, 0)</span>.</p>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="post-multiply">post-multiply</dfn>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="post-multiplied">post-multiplied</dfn>
<dd data-md>
<p>Term <var>A</var> post-multiplied by term <var>B</var> is equal to <var>A</var> · <var>B</var>.</p>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="pre-multiply">pre-multiply</dfn>
<dt data-md><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="pre-multiplied">pre-multiplied</dfn>
<dd data-md>
<p>Term <var>A</var> pre-multiplied by term <var>B</var> is equal to <var>B</var> · <var>A</var>.</p>
<dt data-md><dfn data-dfn-type="dfn" data-export id="multiply">multiply<a class="self-link" href="#multiply"></a></dfn>
<dd data-md>
<p>Multiply term <var>A</var> by term <var>B</var> is equal to <var>A</var> · <var>B</var>.</p>
</dl>
</div>
<h2 class="heading settled" data-level="3" id="transform-rendering"><span class="secno">3. </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>
<p>Specifying a value other than <span class="css">none</span> for the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform③">transform</a> property establishes a new <a data-link-type="dfn" href="#local-coordinate-system" id="ref-for-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" id="ref-for-transformation-matrix">transformation matrix</a>.</p>
<p id="transformation-matrix-computation"> The <a data-link-type="dfn" href="#transformation-matrix" id="ref-for-transformation-matrix①">transformation matrix</a> is computed from the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform④">transform</a> and <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin①">transform-origin</a> properties as follows: </p>
<ol>
<li data-md>
<p>Start with the identity matrix.</p>
<li data-md>
<p>Translate by the computed X and Y of <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin②">transform-origin</a></p>
<li data-md>
<p>Multiply by each of the transform functions in <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform⑤">transform</a> property from left to right</p>
<li data-md>
<p>Translate by the negated computed X and Y values of <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin③">transform-origin</a></p>
</ol>
<div class="example" id="example-192d2b11">
<a class="self-link" href="#example-192d2b11"></a>
<p>An element has a <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform⑥">transform</a> property that is not <span class="css">none</span>.</p>
<pre><code class="highlight"><c- f>div </c-><c- p>{</c->
<c- k>transform-origin</c-><c- p>:</c-> <c- m>0</c-> <c- m>0</c-><c- p>;</c->
<c- k>transform</c-><c- p>:</c-> <c- nf>translate</c-><c- p>(</c-><c- m>-10</c-><c- l>px</c-><c- p>,</c-> <c- m>-20</c-><c- l>px</c-><c- p>)</c-> <c- nf>scale</c-><c- p>(</c-><c- m>2</c-><c- p>)</c-> <c- nf>rotate</c-><c- p>(</c-><c- m>45</c-><c- l>deg</c-><c- p>);</c->
<c- p>}</c->
</code></pre>
<p>The <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin④">transform-origin</a> property is set to <span class="css">0 0</span> and can be omitted. The <a data-link-type="dfn" href="#transformation-matrix" id="ref-for-transformation-matrix②">transformation matrix</a> <i>TM</i> gets computed by post-multying the <a class="production css" data-link-type="function" href="#funcdef-transform-translate" id="ref-for-funcdef-transform-translate"><translate()></a>, <a class="production css" data-link-type="function" href="#funcdef-transform-scale" id="ref-for-funcdef-transform-scale"><scale()></a> and <a class="production css" data-link-type="function" href="#funcdef-transform-rotate" id="ref-for-funcdef-transform-rotate"><rotate()></a> <a class="production css" data-link-type="type" href="#typedef-transform-function" id="ref-for-typedef-transform-function"><transform-function></a>s.</p>
<p><img alt="TM = \begin{bmatrix} 1 & 0 & 0 & -10 \\ 0 & 1 & 0 & -20 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} 2 & 0 & 0 & 0 \\ 0 & 2 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} cos(45) & -sin(45) & 0 & 0 \\ sin(45) & cos(45) & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}" src="images/tm.png" width="627"></p>
</div>
<p>Transforms apply to <a data-link-type="dfn" href="#transformable-element" id="ref-for-transformable-element">transformable elements</a>.</p>
<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.</p>
<p>Transformations are cumulative. That is, elements establish their local coordinate system within the coordinate system of their parent.</p>
<p>To map a point <i>p<sub>local</sub></i> with the coordinate pair <i>x<sub>local</sub></i> and <i>y<sub>local</sub></i> from the <a data-link-type="dfn" href="#local-coordinate-system" id="ref-for-local-coordinate-system②">local coordinate system</a> of an element into the parent’s coordinate system, post-multiply the <a data-link-type="dfn" href="#transformation-matrix" id="ref-for-transformation-matrix③">transformation matrix</a> <i>TM</i> of the element by <i>p<sub>local</sub></i>. The result is the mapped point <i>p<sub>parent</sub></i> with the coordinate pair <i>x<sub>parent</sub></i> and <i>y<sub>parent</sub></i> in the parent’s <a data-link-type="dfn" href="#local-coordinate-system" id="ref-for-local-coordinate-system③">local coordinate system</a>.</p>
<p><img alt="\begin{bmatrix} x_{parent} \\ y_{parent} \\ 0 \\ 1 \end{bmatrix} = TM \cdot \begin{bmatrix} x_{local} \\ y_{local} \\ 0 \\ 1 \end{bmatrix}" src="images/tm-map.png" width="276"></p>
<p>From the perspective of the user, an element effectively accumulates all the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-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" id="ref-for-current-transformation-matrix">current transformation matrix</a> (CTM) for the element.</p>
<p id="current-transformation-matrix-computation"> The <a data-link-type="dfn" href="#current-transformation-matrix" id="ref-for-current-transformation-matrix①">current transformation matrix</a> is computed by post-multiplying all transformation matrices starting from the <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/coords.html#TermViewportCoordinateSystem" id="ref-for-TermViewportCoordinateSystem①">viewport coordinate system</a> and ending with the <a data-link-type="dfn" href="#transformation-matrix" id="ref-for-transformation-matrix④">transformation matrix</a> of an element. </p>
<div class="example" id="example-63675dc3">
<a class="self-link" href="#example-63675dc3"></a> This example has multiple, nested elements in an SVG document. Some elements get transformed by a <a data-link-type="dfn" href="#transformation-matrix" id="ref-for-transformation-matrix⑤">transformation matrix</a>.
<pre><code class="highlight"><c- p><</c-><c- f>svg</c-> <c- e>xmlns</c-><c- o>=</c-><c- s>"http://www.w3.org/2000/svg"</c-><c- p>></c->
<c- p><</c-><c- f>g</c-> <c- e>transform</c-><c- o>=</c-><c- s>"translate(-10, 20)"</c-><c- p>></c->
<c- p><</c-><c- f>g</c-> <c- e>transform</c-><c- o>=</c-><c- s>"scale(2)"</c-><c- p>></c->
<c- p><</c-><c- f>rect</c-> <c- e>width</c-><c- o>=</c-><c- s>"200"</c-> <c- e>height</c-><c- o>=</c-><c- s>"200"</c-> <c- e>transform</c-><c- o>=</c-><c- s>"rotate(45)"</c-><c- p>/></c->
<c- p></</c-><c- f>g</c-><c- p>></c->
<c- p></</c-><c- f>g</c-><c- p>></c->
<c- p></</c-><c- f>svg</c-><c- p>></c->
</code></pre>
<ul>
<li data-md>
<p><span class="css">translate(-10, 20)</span> computes to the transformation matrix <i>T1</i></p>
<li data-md>
<p><span class="css">scale(2)</span> computes to the transformation matrix <i>T2</i></p>
<li data-md>
<p><span class="css">rotate(45)</span> computes to the transformation matrix <i>T3</i></p>
</ul>
<p>The CTM for the SVG <a data-link-type="element" href="https://www.w3.org/TR/svg2/shapes.html#elementdef-rect" id="ref-for-elementdef-rect">rect</a> element is the result of multiplying <i>T1</i>, <i>T2</i> and <i>T3</i> in order.</p>
<p><img alt="CTM = \begin{bmatrix} 1 & 0 & 0 & -10 \\ 0 & 1 & 0 & -20 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} 2 & 0 & 0 & 0 \\ 0 & 2 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} cos(45) & -sin(45) & 0 & 0 \\ sin(45) & cos(45) & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}" src="images/ctm.png" width="627"></p>
<p>To map a point <i>p<sub>local</sub></i> with the coordinate pair <i>x<sub>local</sub></i> and <i>y<sub>local</sub></i> from the <a data-link-type="dfn" href="#local-coordinate-system" id="ref-for-local-coordinate-system④">local coordinate system</a> of the SVG <a data-link-type="element" href="https://www.w3.org/TR/svg2/shapes.html#elementdef-rect" id="ref-for-elementdef-rect①">rect</a> element into the <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/coords.html#TermViewportCoordinateSystem" id="ref-for-TermViewportCoordinateSystem②">viewport coordinate system</a>, post-multiply the <a data-link-type="dfn" href="#current-transformation-matrix" id="ref-for-current-transformation-matrix②">current transformation matrix</a> <i>CTM</i> of the element by <i>p<sub>local</sub></i>. The result is the mapped point <i>p<sub>viewport</sub></i> with the coordinate pair <i>x<sub>viewport</sub></i> and <i>y<sub>viewport</sub></i> in the <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/coords.html#TermViewportCoordinateSystem" id="ref-for-TermViewportCoordinateSystem③">viewport coordinate system</a>.</p>
<p><img alt="\begin{bmatrix} x_{viewport} \\ y_{viewport} \\ 0 \\ 1 \end{bmatrix} = CTM \cdot \begin{bmatrix} x_{local} \\ y_{local} \\ 0 \\ 1 \end{bmatrix}" src="images/ctm-map.png" width="276"></p>
</div>
<p class="note" role="note"><span>Note:</span> Transformations do affect the visual rendering, but have no affect on the CSS layout other than affecting overflow. Transforms are also taken into account when computing client rectangles exposed via the Element Interface Extensions, namely <a href="https://www.w3.org/TR/cssom-view/#dom-element-getclientrects">getClientRects()</a> and <a href="https://www.w3.org/TR/cssom-view/#dom-element-getboundingclientrect">getBoundingClientRect()</a>, which are specified in <a data-link-type="biblio" href="#biblio-cssom-view">[CSSOM-VIEW]</a>.</p>
<div class="example" id="example-76e5e4e0">
<a class="self-link" href="#example-76e5e4e0"></a>
<pre><code class="highlight"><c- f>div </c-><c- p>{</c->
<c- k>transform</c-><c- p>:</c-> <c- nf>translate</c-><c- p>(</c-><c- m>100</c-><c- l>px</c-><c- p>,</c-> <c- m>100</c-><c- l>px</c-><c- p>);</c->
<c- p>}</c->
</code></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" id="example-f319ce51">
<a class="self-link" href="#example-f319ce51"></a>
<pre><code class="highlight"><c- f>div </c-><c- p>{</c->
<c- k>height</c-><c- p>:</c-> <c- m>100</c-><c- l>px</c-><c- p>;</c-> <c- k>width</c-><c- p>:</c-> <c- m>100</c-><c- l>px</c-><c- p>;</c->
<c- k>transform-origin</c-><c- p>:</c-> <c- m>50</c-><c- l>px</c-> <c- m>50</c-><c- l>px</c-><c- p>;</c->
<c- k>transform</c-><c- p>:</c-> <c- nf>rotate</c-><c- p>(</c-><c- m>45</c-><c- l>deg</c-><c- p>);</c->
<c- p>}</c->
</code></pre>
<p>The <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-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" id="example-cc93ebae">
<a class="self-link" href="#example-cc93ebae"></a>
<pre><code class="highlight"><c- f>div </c-><c- p>{</c->
<c- k>height</c-><c- p>:</c-> <c- m>100</c-><c- l>px</c-><c- p>;</c-> <c- k>width</c-><c- p>:</c-> <c- m>100</c-><c- l>px</c-><c- p>;</c->
<c- k>transform</c-><c- p>:</c-> <c- nf>translate</c-><c- p>(</c-><c- m>80</c-><c- l>px</c-><c- p>,</c-> <c- m>80</c-><c- l>px</c-><c- p>)</c-> <c- nf>scale</c-><c- p>(</c-><c- m>1.5</c-><c- p>,</c-> <c- m>1.5</c-><c- p>)</c-> <c- nf>rotate</c-><c- p>(</c-><c- m>45</c-><c- l>deg</c-><c- p>);</c->
<c- p>}</c->
</code></pre>
<p>The visual appareance is as if the <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-div-element" id="ref-for-the-div-element">div</a> element gets translated by 80px to the bottom left direction, then scaled up by 150% and finally rotated by 45°.</p>
<p>Each <a class="production css" data-link-type="type" href="#typedef-transform-function" id="ref-for-typedef-transform-function①"><transform-function></a> can get represented by a corresponding 4x4 matrix. To map a point from the coordinate space of the <a data-link-type="element" href="https://html.spec.whatwg.org/multipage/grouping-content.html#the-div-element" id="ref-for-the-div-element①">div</a> box to the coordinate space of the parent element, these transforms get multiplied in the reverse order:</p>
<ol>
<li data-md>
<p>The rotation matrix gets <a data-link-type="dfn" href="#post-multiplied" id="ref-for-post-multiplied">post-multiplied</a> by the scale matrix.</p>
<li data-md>
<p>The result of the previous multiplication is then <a data-link-type="dfn" href="#post-multiplied" id="ref-for-post-multiplied①">post-multiplied</a> by the translation matrix to create the accumulated transformation matrix.</p>
<li data-md>
<p>Finally, the point to map gets <a data-link-type="dfn" href="#pre-multiplied" id="ref-for-pre-multiplied">pre-multiplied</a> with the accumulated transformation matrix.</p>
</ol>
<p>For more details see <a href="#transform-function-lists">The Transform Function Lists</a>.</p>
<div class="figure"> <img alt="The transform specified above" height="270" src="examples/compound_transform.svg" width="270"> </div>
<p class="note" role="note"><span>Note:</span> The identical rendering can be obtained by nesting elements with the equivalent transforms:</p>
<pre><code class="highlight"><c- p><</c-><c- f>div</c-> <c- e>style</c-><c- o>=</c-><c- s>"transform: translate(80px, 80px)"</c-><c- p>></c->
<c- p><</c-><c- f>div</c-> <c- e>style</c-><c- o>=</c-><c- s>"transform: scale(1.5, 1.5)"</c-><c- p>></c->
<c- p><</c-><c- f>div</c-> <c- e>style</c-><c- o>=</c-><c- s>"transform: rotate(45deg)"</c-><c- p>></</c-><c- f>div</c-><c- p>></c->
<c- p></</c-><c- f>div</c-><c- p>></c->
<c- p></</c-><c- f>div</c-><c- p>></c->
</code></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="https://www.w3.org/TR/css-overflow-3/#propdef-overflow" id="ref-for-propdef-overflow">overflow</a> property is <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-overflow-3/#valdef-overflow-scroll" id="ref-for-valdef-overflow-scroll">scroll</a> or <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css-overflow-3/#valdef-overflow-auto" id="ref-for-valdef-overflow-auto">auto</a>, scrollbars will appear as needed to see content that is transformed outside the visible area. Specifically, transforms can extend (but do not shrink) the size of the overflow area, which is computed as the union of the bounds of the elements before and after the application of transforms.</p>
<p>For elements whose layout is governed by the CSS box model, any value other than <span class="css">none</span> for the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform⑧">transform</a> property results in the creation of a stacking context. Implementations must paint the layer it creates, within its parent stacking context, at the same stacking order that would be used if it were a positioned element with <a class="css" data-link-type="propdesc" href="https://www.w3.org/TR/css3-positioning/#propdef-z-index" id="ref-for-propdef-z-index">z-index: 0</a>. If an element with a transform is positioned, the <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css3-positioning/#propdef-z-index" id="ref-for-propdef-z-index①">z-index</a> property applies as described in <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>, except that <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-positioning/#valdef-z-index-auto" id="ref-for-valdef-z-index-auto">auto</a> is treated as <span class="css">0</span> since a new stacking context is always created.</p>
<p>For elements whose layout is governed by the CSS box model, any value other than <span class="css">none</span> for the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform⑨">transform</a> property also causes the element to establish a <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="containing-block-for-all-descendants">containing block for all descendants</dfn>. Its padding box will be used to layout for all of its absolute-position descendants, fixed-position descendants, and descendant fixed background attachments.</p>
<div class="example" id="example-02d1d5ba">
<a class="self-link" href="#example-02d1d5ba"></a> To demostrate the effect of <a data-link-type="dfn" href="#containing-block-for-all-descendants" id="ref-for-containing-block-for-all-descendants">containing block for all descendants</a> on fixed-position descendants, the following code snippets should behave identically:
<pre><code class="highlight"><c- p><</c-><c- f>style</c-><c- p>></c->
<c- p>#</c-><c- nn>container</c-> <c- p>{</c->
<c- k>width</c-><c- p>:</c-> <c- mi>300</c-><c- b>px</c-><c- p>;</c->
<c- k>height</c-><c- p>:</c-> <c- mi>200</c-><c- b>px</c-><c- p>;</c->
<c- k>border</c-><c- p>:</c-> <c- mi>5</c-><c- b>px</c-> <c- kc>dashed</c-> <c- kc>black</c-><c- p>;</c->
<c- k>padding</c-><c- p>:</c-> <c- mi>5</c-><c- b>px</c-><c- p>;</c->
<c- k>overflow</c-><c- p>:</c-> <c- kc>scroll</c-><c- p>;</c->
<c- p>}</c->
<c- p>#</c-><c- nn>bloat</c-> <c- p>{</c->
<c- k>height</c-><c- p>:</c-> <c- mi>1000</c-><c- b>px</c-><c- p>;</c->
<c- p>}</c->
<c- p>#</c-><c- nn>child</c-> <c- p>{</c->
<c- k>right</c-><c- p>:</c-> <c- mi>0</c-><c- p>;</c->
<c- k>bottom</c-><c- p>:</c-> <c- mi>0</c-><c- p>;</c->
<c- k>width</c-><c- p>:</c-> <c- mi>10</c-><c- b>%</c-><c- p>;</c->
<c- k>height</c-><c- p>:</c-> <c- mi>10</c-><c- b>%</c-><c- p>;</c->
<c- k>background</c-><c- p>:</c-> <c- kc>green</c-><c- p>;</c->
<c- p>}</c->
<c- p></</c-><c- f>style</c-><c- p>></c->
<c- p><</c-><c- f>div</c-> <c- e>id</c-><c- o>=</c-><c- s>"container"</c-> <c- e>style</c-><c- o>=</c-><c- s>"transform:translateX(5px);"</c-><c- p>></c->
<c- p><</c-><c- f>div</c-> <c- e>id</c-><c- o>=</c-><c- s>"bloat"</c-><c- p>></</c-><c- f>div</c-><c- p>></c->
<c- p><</c-><c- f>div</c-> <c- e>id</c-><c- o>=</c-><c- s>"child"</c-> <c- e>style</c-><c- o>=</c-><c- s>"position:fixed;"</c-><c- p>></</c-><c- f>div</c-><c- p>></c->
<c- p></</c-><c- f>div</c-><c- p>></c->
</code></pre>
<p>versus</p>
<pre><code class="highlight"><c- p><</c-><c- f>div</c-> <c- e>id</c-><c- o>=</c-><c- s>"container"</c-> <c- e>style</c-><c- o>=</c-><c- s>"position:relative; z-index:0; left:5px;"</c-><c- p>></c->
<c- p><</c-><c- f>div</c-> <c- e>id</c-><c- o>=</c-><c- s>"bloat"</c-><c- p>></</c-><c- f>div</c-><c- p>></c->
<c- p><</c-><c- f>div</c-> <c- e>id</c-><c- o>=</c-><c- s>"child"</c-> <c- e>style</c-><c- o>=</c-><c- s>"position:absolute;"</c-><c- p>></</c-><c- f>div</c-><c- p>></c->
<c- p></</c-><c- f>div</c-><c- p>></c->
</code></pre>
</div>
<p><a href="https://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 <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-background/#valdef-background-attachment-fixed" id="ref-for-valdef-background-attachment-fixed①">fixed</a> for the <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css3-background/#propdef-background-attachment" id="ref-for-propdef-background-attachment①">background-attachment</a> property is treated as if it had a value of <a class="css" data-link-type="maybe" href="https://www.w3.org/TR/css3-background/#valdef-background-attachment-scroll" id="ref-for-valdef-background-attachment-scroll">scroll</a>. The computed value of <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css3-background/#propdef-background-attachment" id="ref-for-propdef-background-attachment②">background-attachment</a> is not affected.</p>
<p class="note" role="note"><span>Note:</span> If the root element is transformed, the transformation applies to the entire canvas, including any background specified for the root element. Since <a href="https://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">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.</p>
<h2 class="heading settled" data-level="4" id="transform-property"><span class="secno">4. </span><span class="content">The <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-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 into through the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-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.</p>
<table class="def propdef" data-link-for-hint="transform">
<tbody>
<tr>
<th>Name:
<td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-transform">transform</dfn>
<tr class="value">
<th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a>
<td class="prod">none <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one">|</a> <a class="production css" data-link-type="type" href="#typedef-transform-list" id="ref-for-typedef-transform-list"><transform-list></a>
<tr>
<th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a>
<td>none
<tr>
<th>Applies to:
<td><a data-link-type="dfn" href="#transformable-element" id="ref-for-transformable-element①">transformable elements</a>
<tr>
<th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a>
<td>no
<tr>
<th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a>
<td>refer to the size of <a data-link-type="dfn" href="#reference-box" id="ref-for-reference-box①">reference box</a>
<tr>
<th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a>
<td>as specified, but with lengths made absolute
<tr>
<th>Canonical order:
<td>per grammar
<tr>
<th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a>
<td>transform list, see <a href="#interpolation-of-transforms">interpolation rules</a>
</table>
<p>Any computed value other than <span class="css">none</span> for the transform affects containing block and stacking context, as described in <a href="#transform-rendering">§3 The Transform Rendering Model</a>.</p>
<pre class="prod"><dfn class="dfn-paneled" data-dfn-type="type" data-export id="typedef-transform-list"><transform-list></dfn> = <a class="production" data-link-type="type" href="#typedef-transform-function" id="ref-for-typedef-transform-function②"><transform-function></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-one-plus" id="ref-for-mult-one-plus">+</a></pre>
<h3 class="heading settled" data-level="4.1" id="serialization-of-transform-functions"><span class="secno">4.1. </span><span class="content">Serialization of <a class="production css" data-link-type="type" href="#typedef-transform-function" id="ref-for-typedef-transform-function③"><transform-function></a>s</span><a class="self-link" href="#serialization-of-transform-functions"></a></h3>
<p>To serialize the <a class="production css" data-link-type="type" href="#typedef-transform-function" id="ref-for-typedef-transform-function④"><transform-function></a>s, serialize as per their individual grammars, in the order the grammars are written in, avoiding <a class="production css" data-link-type="function" href="https://www.w3.org/TR/css-values-4/#funcdef-calc" id="ref-for-funcdef-calc"><calc()></a> expressions where possible, avoiding <a class="production css" data-link-type="function" href="https://www.w3.org/TR/css-values-4/#funcdef-calc" id="ref-for-funcdef-calc①"><calc()></a> transformations, omitting components when possible without changing the meaning, joining space-separated tokens with a single space, and following each serialized comma with a single space.</p>
<h3 class="heading settled" data-level="4.2" id="serialization-of-the-computed-value"><span class="secno">4.2. </span><span class="content">Serialization of the computed value of <a class="production css" data-link-type="type" href="#typedef-transform-list" id="ref-for-typedef-transform-list①"><transform-list></a></span><a class="self-link" href="#serialization-of-the-computed-value"></a></h3>
<p>A <a class="production css" data-link-type="type" href="#typedef-transform-list" id="ref-for-typedef-transform-list②"><transform-list></a> for the computed value is serialized to one <a class="production css" data-link-type="function" href="#funcdef-transform-matrix" id="ref-for-funcdef-transform-matrix"><matrix()></a> function by the following algorithm:</p>
<ol class="algorithm">
<li data-md>
<p>Let <var>transform</var> be a 4x4 matrix initialized to the identity matrix. The elements <var> m11</var>, <var>m22</var>, <var>m33</var> and <var>m44</var> of <var>transform</var> must be set to <span class="css">1</span> all other elements of <var>transform</var> must be set to <span class="css">0</span>.</p>
<li data-md>
<p>Post-multiply all <a class="production css" data-link-type="type" href="#typedef-transform-function" id="ref-for-typedef-transform-function⑤"><transform-function></a>s in <a class="production css" data-link-type="type" href="#typedef-transform-list" id="ref-for-typedef-transform-list③"><transform-list></a> to <var>transform</var>.</p>
<li data-md>
<p>Serialize <var>transform</var> to a <a class="production css" data-link-type="function" href="#funcdef-transform-matrix" id="ref-for-funcdef-transform-matrix①"><matrix()></a> function.</p>
</ol>
<h2 class="heading settled" data-level="5" id="transform-origin-property"><span class="secno">5. </span><span class="content">The <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin⑥">transform-origin</a> Property</span><a class="self-link" href="#transform-origin-property"></a></h2>
<table class="def propdef" data-link-for-hint="transform-origin">
<tbody>
<tr>
<th>Name:
<td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-transform-origin">transform-origin</dfn>
<tr class="value">
<th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a>
<td class="prod"> [ left <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①">|</a> center <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②">|</a> right <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one③">|</a> top <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one④">|</a> bottom <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑤">|</a> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage"><length-percentage></a> ]<br> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑥">|</a> <br> [ left <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑦">|</a> center <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑧">|</a> right <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one⑨">|</a> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage①"><length-percentage></a> ]<br> [ top <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⓪">|</a> center <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①①">|</a> bottom <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①②">|</a> <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage②"><length-percentage></a> ] <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#length-value" id="ref-for-length-value" title="Expands to: em | vb | ch | cm | vh | vi | in | ex | vw | ic | pt | px | lh | pc | rem | rlh | vmax | advance measure | vmin | mm | cap | q"><length></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt">?</a><br> <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①③">|</a><br> [[ center <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①④">|</a> left <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑤">|</a> right ] <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-all" id="ref-for-comb-all">&&</a> [ center <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑥">|</a> top <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑦">|</a> bottom ]] <a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#length-value" id="ref-for-length-value①" title="Expands to: em | vb | ch | cm | vh | vi | in | ex | vw | ic | pt | px | lh | pc | rem | rlh | vmax | advance measure | vmin | mm | cap | q"><length></a><a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#mult-opt" id="ref-for-mult-opt①">?</a>
<tr>
<th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a>
<td>50% 50%
<tr>
<th>Applies to:
<td><a data-link-type="dfn" href="#transformable-element" id="ref-for-transformable-element②">transformable elements</a>
<tr>
<th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a>
<td>no
<tr>
<th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a>
<td>refer to the size of <a data-link-type="dfn" href="#reference-box" id="ref-for-reference-box②">reference box</a>
<tr>
<th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a>
<td>see <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/css3-background/#propdef-background-position" id="ref-for-propdef-background-position">background-position</a>
<tr>
<th>Canonical order:
<td>per grammar
<tr>
<th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a>
<td>by computed value
</table>
<p>The values of the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform①②">transform</a> and <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin⑦">transform-origin</a> properties are used to compute the <a data-link-type="dfn" href="#transformation-matrix" id="ref-for-transformation-matrix⑥">transformation matrix</a>, as described above.</p>
<p>If only one value is specified, the second value is assumed to be <a class="css" data-link-type="value" href="#valdef-transform-origin-center" id="ref-for-valdef-transform-origin-center">center</a>. If one or two values are specified, the third value is assumed to be <span class="css">0px</span>.</p>
<p>If two or more values are defined and either no value is a keyword, or the only used keyword is <a class="css" data-link-type="value" href="#valdef-transform-origin-center" id="ref-for-valdef-transform-origin-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" data-link-type="type" href="https://www.w3.org/TR/css3-values/#length-value" id="ref-for-length-value②" title="Expands to: em | vb | ch | cm | vh | vi | in | ex | vw | ic | pt | px | lh | pc | rem | rlh | vmax | advance measure | vmin | mm | cap | q"><length></a>.</p>
<dl>
<dt data-md><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-values-4/#typedef-length-percentage" id="ref-for-typedef-length-percentage③"><length-percentage></a>
<dd data-md>
<p>A percentage for the horizontal offset is relative to the width of the <a data-link-type="dfn" href="#reference-box" id="ref-for-reference-box③">reference box</a>. A percentage for the vertical offset is relative to the height of the <a data-link-type="dfn" href="#reference-box" id="ref-for-reference-box④">reference 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="#reference-box" id="ref-for-reference-box⑤">reference box</a>.</p>
<dt data-md><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css3-values/#length-value" id="ref-for-length-value③" title="Expands to: em | vb | ch | cm | vh | vi | in | ex | vw | ic | pt | px | lh | pc | rem | rlh | vmax | advance measure | vmin | mm | cap | q"><length></a>
<dd data-md>
<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="#reference-box" id="ref-for-reference-box⑥">reference box</a>.</p>
<dt data-md><dfn class="css" data-dfn-for="transform-origin" data-dfn-type="value" data-export id="valdef-transform-origin-top">top<a class="self-link" href="#valdef-transform-origin-top"></a></dfn>
<dd data-md>
<p>Computes to <span class="css">0%</span> for the vertical position.</p>
<dt data-md><dfn class="css" data-dfn-for="transform-origin" data-dfn-type="value" data-export id="valdef-transform-origin-right">right<a class="self-link" href="#valdef-transform-origin-right"></a></dfn>
<dd data-md>
<p>Computes to <span class="css">100%</span> for the horizontal position.</p>
<dt data-md><dfn class="css" data-dfn-for="transform-origin" data-dfn-type="value" data-export id="valdef-transform-origin-bottom">bottom<a class="self-link" href="#valdef-transform-origin-bottom"></a></dfn>
<dd data-md>
<p>Computes to <span class="css">100%</span> for the vertical position.</p>
<dt data-md><dfn class="css" data-dfn-for="transform-origin" data-dfn-type="value" data-export id="valdef-transform-origin-left">left<a class="self-link" href="#valdef-transform-origin-left"></a></dfn>
<dd data-md>
<p>Computes to <span class="css">0%</span> for the horizontal position.</p>
<dt data-md><dfn class="dfn-paneled css" data-dfn-for="transform-origin" data-dfn-type="value" data-export id="valdef-transform-origin-center">center</dfn>
<dd data-md>
<p>Computes to <span class="css">50%</span> (<span class="css">left 50%</span>) for the horizontal position if the horizontal position is not otherwise specified, or <span class="css">50%</span> (<span class="css">top 50%</span>) for the vertical position if it is.</p>
</dl>
<p>For SVG elements without associated CSS layout box the initial <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-4/#used-value" id="ref-for-used-value">used value</a> is <span class="css">0 0</span> as if the user agent style sheet contained:</p>
<pre><code class="highlight"><c- f>*:not(svg), *:not(foreignObject) > svg </c-><c- p>{</c->
<c- k>transform-origin</c-><c- p>:</c-> <c- m>0</c-> <c- m>0</c-><c- p>;</c->
<c- p>}</c->
</code></pre>
<p>The <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin⑧">transform-origin</a> property is a <a data-link-type="dfn" href="https://drafts.csswg.org/cssom-1/#resolved-value-special-case-property" id="ref-for-resolved-value-special-case-property">resolved value special case property</a> like <a class="property" data-link-type="propdesc" href="https://www.w3.org/TR/CSS21/visudet.html#propdef-height" id="ref-for-propdef-height">height</a>. <a data-link-type="biblio" href="#biblio-cssom">[CSSOM]</a></p>
<h2 class="heading settled" data-level="6" id="transform-box"><span class="secno">6. </span><span class="content">Transform reference box: the <a class="property" data-link-type="propdesc" href="#propdef-transform-box" id="ref-for-propdef-transform-box①">transform-box</a> property</span><a class="self-link" href="#transform-box"></a></h2>
<table class="def propdef" data-link-for-hint="transform-box">
<tbody>
<tr>
<th>Name:
<td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-transform-box">transform-box</dfn>
<tr class="value">
<th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a>
<td class="prod">content-box <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑧">|</a> border-box <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one①⑨">|</a> fill-box <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②⓪">|</a> stroke-box <a data-link-type="grammar" href="https://www.w3.org/TR/css-values-4/#comb-one" id="ref-for-comb-one②①">|</a> view-box
<tr>
<th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a>
<td>view-box
<tr>
<th>Applies to:
<td><a data-link-type="dfn" href="#transformable-element" id="ref-for-transformable-element③">transformable elements</a>
<tr>
<th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a>
<td>no
<tr>
<th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a>
<td>N/A
<tr>
<th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a>
<td>specified keyword
<tr>
<th>Canonical order:
<td>per grammar
<tr>
<th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a>
<td>discrete
</table>
<p>All transformations defined by the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform①③">transform</a> and <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin⑨">transform-origin</a> property are relative to the position and dimensions of the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="reference-box">reference box</dfn> of the element. The <a data-link-type="dfn" href="#reference-box" id="ref-for-reference-box⑦">reference box</a> is specified by one of the following:</p>
<dl>
<dt data-md><dfn class="dfn-paneled css" data-dfn-for="transform-box" data-dfn-type="value" data-export id="valdef-transform-box-content-box">content-box</dfn>
<dd data-md>
<p>Uses the content box as reference box. The reference box of a table is the border box of its <a href="https://www.w3.org/TR/CSS21/tables.html#model">table wrapper box</a>, not its table box.</p>
<dt data-md><dfn class="dfn-paneled css" data-dfn-for="transform-box" data-dfn-type="value" data-export id="valdef-transform-box-border-box">border-box</dfn>
<dd data-md>
<p>Uses the border box as reference box. The reference box of a table is the border box of its <a href="https://www.w3.org/TR/CSS21/tables.html#model">table wrapper box</a>, not its table box.</p>
<dt data-md><dfn class="dfn-paneled css" data-dfn-for="transform-box" data-dfn-type="value" data-export id="valdef-transform-box-fill-box">fill-box</dfn>
<dd data-md>
<p>Uses the <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/coords.html#TermObjectBoundingBox" id="ref-for-TermObjectBoundingBox">object bounding box</a> as reference box.</p>
<dt data-md><dfn class="dfn-paneled css" data-dfn-for="transform-box" data-dfn-type="value" data-export id="valdef-transform-box-stroke-box">stroke-box</dfn>
<dd data-md>
<p>Uses the <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/coords.html#TermStrokeBoundingBox" id="ref-for-TermStrokeBoundingBox">stroke bounding box</a> as reference box.</p>
<dt data-md><dfn class="dfn-paneled css" data-dfn-for="transform-box" data-dfn-type="value" data-export id="valdef-transform-box-view-box">view-box</dfn>
<dd data-md>
<p>Uses the nearest <a href="https://www.w3.org/TR/SVG11/intro.html#TermSVGViewport">SVG viewport</a> as reference box.</p>
<p>If a <code class="idl"><a data-link-type="idl">viewBox</a></code> attribute is specified for the <a href="https://www.w3.org/TR/SVG11/intro.html#TermSVGViewport">SVG viewport</a> creating element:</p>
<ul>
<li data-md>
<p>The reference box is positioned at the origin of the coordinate system established by the <code class="idl"><a data-link-type="idl">viewBox</a></code> attribute.</p>
<li data-md>
<p>The dimension of the reference box is set to the <em>width</em> and <em>height</em> values of the <code class="idl"><a data-link-type="idl">viewBox</a></code> attribute.</p>
</ul>
</dl>
<p>For the SVG <code><a data-link-type="element" href="https://www.w3.org/TR/svg2/pservers.html#elementdef-pattern" id="ref-for-elementdef-pattern">pattern</a></code> element, the reference box gets defined by the <code><a data-link-type="element-sub" href="https://www.w3.org/TR/SVG/pservers.html#PatternElementPatternUnitsAttribute" id="ref-for-PatternElementPatternUnitsAttribute">patternUnits</a></code> attribute <a data-link-type="biblio" href="#biblio-svg2">[SVG2]</a>.</p>
<p>For the SVG <a data-link-type="element" href="https://www.w3.org/TR/svg2/pservers.html#elementdef-linearGradient" id="ref-for-elementdef-linearGradient">linearGradient</a> and <a data-link-type="element" href="https://www.w3.org/TR/svg2/pservers.html#elementdef-radialGradient" id="ref-for-elementdef-radialGradient">radialGradient</a> elements, the reference box gets defined by the <code><a data-link-type="element-sub" href="https://www.w3.org/TR/SVG/pservers.html#LinearGradientElementGradientUnitsAttribute" id="ref-for-LinearGradientElementGradientUnitsAttribute">gradientUnits</a></code> attribute <a data-link-type="biblio" href="#biblio-svg2">[SVG2]</a>.</p>
<p>For the SVG <a data-link-type="element" href="https://www.w3.org/TR/css-masking-1/#elementdef-clippath" id="ref-for-elementdef-clippath①">clipPath</a> element, the reference box gets defined by the <code><a data-link-type="element-sub" href="https://www.w3.org/TR/css-masking-1/#element-attrdef-clippathunits" id="ref-for-element-attrdef-clippathunits">clipPathUnits</a></code> attribute <a data-link-type="biblio" href="#biblio-css-masking">[CSS-MASKING]</a>.</p>
<p>A reference box adds an additional offset to the origin specified by the <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin①⓪">transform-origin</a> property.</p>
<p>For SVG elements without associated CSS layout box, the <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-4/#used-value" id="ref-for-used-value①">used value</a> for <a class="css" data-link-type="maybe" href="#valdef-transform-box-content-box" id="ref-for-valdef-transform-box-content-box">content-box</a> is <a class="css" data-link-type="maybe" href="#valdef-transform-box-fill-box" id="ref-for-valdef-transform-box-fill-box">fill-box</a> and for <a class="css" data-link-type="maybe" href="#valdef-transform-box-border-box" id="ref-for-valdef-transform-box-border-box">border-box</a> is <a class="css" data-link-type="maybe" href="#valdef-transform-box-stroke-box" id="ref-for-valdef-transform-box-stroke-box">stroke-box</a>.</p>
<p>For elements with associated CSS layout box, the <a data-link-type="dfn" href="https://www.w3.org/TR/css-cascade-4/#used-value" id="ref-for-used-value②">used value</a> for <a class="css" data-link-type="maybe" href="#valdef-transform-box-fill-box" id="ref-for-valdef-transform-box-fill-box①">fill-box</a> is <a class="css" data-link-type="maybe" href="#valdef-transform-box-content-box" id="ref-for-valdef-transform-box-content-box①">content-box</a> and for <a class="css" data-link-type="maybe" href="#valdef-transform-box-stroke-box" id="ref-for-valdef-transform-box-stroke-box①">stroke-box</a> and <a class="css" data-link-type="maybe" href="#valdef-transform-box-view-box" id="ref-for-valdef-transform-box-view-box">view-box</a> is <a class="css" data-link-type="maybe" href="#valdef-transform-box-border-box" id="ref-for-valdef-transform-box-border-box①">border-box</a>.</p>
<h2 class="heading settled" data-level="7" id="svg-transform"><span class="secno">7. </span><span class="content">The SVG <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/coords.html#TransformAttribute" id="ref-for-TransformAttribute">transform</a> Attribute</span><a class="self-link" href="#svg-transform"></a></h2>
<h3 class="heading settled" data-level="7.1" id="transform-attribute-specificity"><span class="secno">7.1. </span><span class="content">SVG presentation attributes</span><a class="self-link" href="#transform-attribute-specificity"></a></h3>
<p>The <a class="property" data-link-type="propdesc" href="#propdef-transform-origin" id="ref-for-propdef-transform-origin①①">transform-origin</a> CSS property is also a <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/styling.html#TermPresentationAttribute" id="ref-for-TermPresentationAttribute">presentation attribute</a> and extends the list of existing <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/styling.html#TermPresentationAttribute" id="ref-for-TermPresentationAttribute①">presentation attributes</a> <a data-link-type="biblio" href="#biblio-svg2">[SVG2]</a>.</p>
<p>SVG 2 defines the <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/coords.html#TransformAttribute" id="ref-for-TransformAttribute①">transform</a>, <code><a data-link-type="element-sub" href="https://www.w3.org/TR/SVG11/pservers.html#PatternElementPatternTransformAttribute" id="ref-for-PatternElementPatternTransformAttribute">patternTransform</a></code>, <code><a data-link-type="element-sub" href="https://www.w3.org/TR/SVG11/pservers.html#LinearGradientElementGradientTransformAttribute" id="ref-for-LinearGradientElementGradientTransformAttribute">gradientTransform</a></code> attributes as <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/styling.html#TermPresentationAttribute" id="ref-for-TermPresentationAttribute②">presentation attributes</a>, represented by the CSS <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform①④">transform</a> property <a data-link-type="biblio" href="#biblio-svg2">[SVG2]</a>.</p>
<p>The participation in the CSS cascade is determined by the specificity of <a data-link-type="dfn" href="https://www.w3.org/TR/svg2/styling.html#TermPresentationAttribute" id="ref-for-TermPresentationAttribute③">presentation attributes</a> in the SVG specification. According to SVG, user agents conceptually insert a <a href="https://www.w3.org/TR/SVG/styling.html#UsingPresentationAttributes">new author style sheet</a> for presentation attributes, which is the first in the author style sheet collection <a data-link-type="biblio" href="#biblio-svg2">[SVG2]</a>.</p>
<div class="example" id="example-ae528470">
<a class="self-link" href="#example-ae528470"></a> This example shows the combination of the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform①⑤">transform</a> style property and the <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/coords.html#TransformAttribute" id="ref-for-TransformAttribute②">transform</a> attribute.
<pre><code class="highlight"><c- f><svg</c-> <c- e>xmlns=</c-><c- s>"http://www.w3.org/2000/svg"</c-><c- f>></c->
<c- f><style></c->
.container {
transform: translate(100px, 100px);
}
<c- f></style></c->
<c- f><g</c-> <c- e>class=</c-><c- s>"container"</c-> <c- e>transform=</c-><c- s>"translate(200 200)"</c-><c- f>></c->
<c- f><rect</c-> <c- e>width=</c-><c- s>"100"</c-> <c- e>height=</c-><c- s>"100"</c-> <c- e>fill=</c-><c- s>"blue"</c-> <c- f>/></c->
<c- f></g></c->
<c- f></svg></c->
</code></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" id="ref-for-propdef-transform①⑥">transform</a> style property overrides the <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/coords.html#TransformAttribute" id="ref-for-TransformAttribute③">transform</a> attribute. Therefore the container gets translated by <span class="css">100px</span> in both the horizontal and the vertical directions, instead of <span class="css">200px</span>.</p>
</div>
<h3 class="heading settled" data-level="7.2" id="svg-syntax"><span class="secno">7.2. </span><span class="content">Syntax of the SVG <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/coords.html#TransformAttribute" id="ref-for-TransformAttribute④">transform</a> attribute</span><a class="self-link" href="#svg-syntax"></a></h3>
<p>For backwards compatibility reasons, the syntax of the <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/coords.html#TransformAttribute" id="ref-for-TransformAttribute⑤">transform</a>, <code><a data-link-type="element-sub" href="https://www.w3.org/TR/SVG11/pservers.html#PatternElementPatternTransformAttribute" id="ref-for-PatternElementPatternTransformAttribute①">patternTransform</a></code>, <code><a data-link-type="element-sub" href="https://www.w3.org/TR/SVG11/pservers.html#LinearGradientElementGradientTransformAttribute" id="ref-for-LinearGradientElementGradientTransformAttribute①">gradientTransform</a></code> attributes differ from the syntax of the <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform①⑦">transform</a> CSS property. For the attributes, there is no support for additional <a class="production css" data-link-type="type" href="#typedef-transform-function" id="ref-for-typedef-transform-function⑥"><transform-function></a>s defined for the CSS <a class="property" data-link-type="propdesc" href="#propdef-transform" id="ref-for-propdef-transform①⑧">transform</a> property. Specifically, <a class="production css" data-link-type="function" href="#funcdef-transform-translatex" id="ref-for-funcdef-transform-translatex"><translateX()></a>, <a class="production css" data-link-type="function" href="#funcdef-transform-translatey" id="ref-for-funcdef-transform-translatey"><translateY()></a>, <a class="production css" data-link-type="function" href="#funcdef-transform-scalex" id="ref-for-funcdef-transform-scalex"><scaleX()></a>, <a class="production css" data-link-type="function" href="#funcdef-transform-scaley" id="ref-for-funcdef-transform-scaley"><scaleY()></a> and <a class="production css" data-link-type="function" href="#funcdef-transform-skew" id="ref-for-funcdef-transform-skew"><skew()></a> are not supported by the <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/coords.html#TransformAttribute" id="ref-for-TransformAttribute⑥">transform</a>, <code><a data-link-type="element-sub" href="https://www.w3.org/TR/SVG11/pservers.html#PatternElementPatternTransformAttribute" id="ref-for-PatternElementPatternTransformAttribute②">patternTransform</a></code>, <code><a data-link-type="element-sub" href="https://www.w3.org/TR/SVG11/pservers.html#LinearGradientElementGradientTransformAttribute" id="ref-for-LinearGradientElementGradientTransformAttribute②">gradientTransform</a></code> attributes.</p>
<p>The following list uses the Backus-Naur Form (BNF) to define values for the <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/coords.html#TransformAttribute" id="ref-for-TransformAttribute⑦">transform</a>, <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/pservers.html#PatternElementPatternTransformAttribute" id="ref-for-PatternElementPatternTransformAttribute③">patternTransform</a> and <a data-link-type="element-attr" href="https://www.w3.org/TR/SVG11/pservers.html#LinearGradientElementGradientTransformAttribute" id="ref-for-LinearGradientElementGradientTransformAttribute③">gradientTransform</a> attributes followed by an informative rail road diagram. The following notation is used:</p>
<ul>
<li data-md>
<p>*: 0 or more</p>
<li data-md>
<p>+: 1 or more</p>
<li data-md>
<p>?: 0 or 1</p>
<li data-md>
<p>(): grouping</p>
<li data-md>
<p>|: separates alternatives</p>
<li data-md>
<p>double quotes surround literals. Literals consists of <a data-link-type="dfn" href="https://www.w3.org/TR/css-syntax-3/#letter" id="ref-for-letter">letter</a>s <a data-link-type="biblio" href="#biblio-css-syntax-3">[CSS-SYNTAX-3]</a>, left parenthesis and right parenthesis.</p>
<li data-md>
<p><a class="production css" data-link-type="type" href="https://www.w3.org/TR/css-syntax-3/#typedef-number-token" id="ref-for-typedef-number-token"><number-token></a> defined by the CSS Syntax module <a data-link-type="biblio" href="#biblio-css-syntax-3">[CSS-SYNTAX-3]</a>.</p>
</ul>
<p class="note" role="note"><span>Note:</span> The syntax reflects implemented behavior in user agents and differs from the syntax defined by SVG 1.1.</p>
<dl>
<dt>left parenthesis (
<dd>U+0028 LEFT PARENTHESIS
<dt>right parenthesis )
<dd>U+0029 RIGHT PARENTHESIS
<dt id="svg-comma"><a class="self-link" href="#svg-comma"></a>comma
<dd>U+002C COMMA.
<dt id="svg-wsp"><a class="self-link" href="#svg-wsp"></a>wsp
<dd>Either a U+000A LINE FEED, U+000D CARRIAGE RETURN, U+0009 CHARACTER TABULATION, or U+0020 SPACE.
<dd>
<div class="railroad">
<svg class="railroad-diagram" height="152" viewBox="0 0 180 152" width="180">
<g transform="translate(.5 .5)">
<path d="M 20 21 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path>
<g>
<path d="M40 31h0"></path>
<path d="M140 31h0"></path>
<path d="M40 31h20"></path>
<g class="terminal">
<path d="M60 31h0"></path>
<path d="M120 31h0"></path>
<rect height="22" rx="10" ry="10" width="60" x="60" y="20"></rect>
<a href>
<text x="90" y="35">space</text>
<text x="90" y="35">space</text>
</a>
</g>
<path d="M120 31h20"></path>
<path d="M40 31a10 10 0 0 1 10 10v10a10 10 0 0 0 10 10"></path>
<g class="terminal">
<path d="M60 61h12"></path>
<path d="M108 61h12"></path>
<rect height="22" rx="10" ry="10" width="36" x="72" y="50"></rect>
<a href>
<text x="90" y="65">\t</text>
<text x="90" y="65">\t</text>
</a>
</g>
<path d="M120 61a10 10 0 0 0 10 -10v-10a10 10 0 0 1 10 -10"></path>
<path d="M40 31a10 10 0 0 1 10 10v40a10 10 0 0 0 10 10"></path>
<g class="terminal">
<path d="M60 91h12"></path>
<path d="M108 91h12"></path>
<rect height="22" rx="10" ry="10" width="36" x="72" y="80"></rect>
<a href>
<text x="90" y="95">\r</text>
<text x="90" y="95">\r</text>
</a>
</g>
<path d="M120 91a10 10 0 0 0 10 -10v-40a10 10 0 0 1 10 -10"></path>
<path d="M40 31a10 10 0 0 1 10 10v70a10 10 0 0 0 10 10"></path>
<g class="terminal">
<path d="M60 121h12"></path>
<path d="M108 121h12"></path>
<rect height="22" rx="10" ry="10" width="36" x="72" y="110"></rect>
<a href>
<text x="90" y="125">\f</text>
<text x="90" y="125">\f</text>
</a>
</g>
<path d="M120 121a10 10 0 0 0 10 -10v-70a10 10 0 0 1 10 -10"></path>
</g>
<path d="M 140 31 h 20 m -10 -10 v 20 m 10 -20 v 20"></path>
</g>
</svg>
</div>
<dt id="svg-comma-wsp"><a class="self-link" href="#svg-comma-wsp"></a>comma-wsp
<dd>
<pre>(wsp+ comma? wsp*) | (comma wsp*)</pre>
<dd>
<div class="railroad">
<svg class="railroad-diagram" height="128" viewBox="0 0 398 128" width="398">
<g transform="translate(.5 .5)">
<path d="M 20 30 v 20 m 10 -20 v 20 m -10 -10 h 20.5"></path>
<g>
<path d="M40 40h0"></path>
<path d="M358 40h0"></path>
<path d="M40 40h20"></path>
<g>
<path d="M60 40h0"></path>
<path d="M338 40h0"></path>
<g>
<path d="M60 40h0"></path>
<path d="M124 40h0"></path>
<path d="M60 40h10"></path>
<g class="non-terminal">
<path d="M70 40h0"></path>
<path d="M114 40h0"></path>
<rect height="22" width="44" x="70" y="29"></rect>
<a href>
<text x="92" y="44">wsp</text>
<text x="92" y="44">wsp</text>
</a>
</g>
<path d="M114 40h10"></path>
<path d="M70 40a10 10 0 0 0 -10 10v0a10 10 0 0 0 10 10"></path>
<g>
<path d="M70 60h44"></path>
</g>
<path d="M114 60a10 10 0 0 0 10 -10v0a10 10 0 0 0 -10 -10"></path>
</g>
<path d="M124 40h10"></path>
<g>
<path d="M134 40h0"></path>
<path d="M234 40h0"></path>
<path d="M134 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path>
<g>
<path d="M154 20h60"></path>
</g>
<path d="M214 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path>
<path d="M134 40h20"></path>
<g class="non-terminal">
<path d="M154 40h0"></path>
<path d="M214 40h0"></path>
<rect height="22" width="60" x="154" y="29"></rect>
<a href>
<text x="184" y="44">comma</text>
<text x="184" y="44">comma</text>
</a>
</g>
<path d="M214 40h20"></path>
</g>
<g>
<path d="M234 40h0"></path>
<path d="M338 40h0"></path>
<path d="M234 40a10 10 0 0 0 10 -10v0a10 10 0 0 1 10 -10"></path>
<g>
<path d="M254 20h64"></path>
</g>
<path d="M318 20a10 10 0 0 1 10 10v0a10 10 0 0 0 10 10"></path>
<path d="M234 40h20"></path>
<g>
<path d="M254 40h0"></path>
<path d="M318 40h0"></path>
<path d="M254 40h10"></path>
<g class="non-terminal">
<path d="M264 40h0"></path>
<path d="M308 40h0"></path>
<rect height="22" width="44" x="264" y="29"></rect>
<a href>