You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<pclass=note>It is recommended that authors not mix different types of units, such as px, em, or %, in a single rule, as this can cause a color-stop to unintentionally try to move before an earlier one. For example, the rule <code>background-image: linear-gradient(red, yellow 100px, blue 50%)</code> would work as expected as long as the background area is at least 200px tall. If it was 150px tall, however, the blue color-stop's position would be equivalent to "75px", which precedes the yellow color-stop, and would be corrected to a position of 100px.</p>
<p>To serialize a linear gradient, let s initially be the empty string, run these steps, and then return s:</p>
426
-
<ol>
427
-
<li>Append "linear-gradient(" to s.</li>
428
-
<li>
429
-
<ul>
430
-
<li>If the first argument to the gradient function was a single keyword, serialize the keyword and append it to s.</li>
431
-
<li>Otherwise, if the first argument to the gradient function was two keywords, serialize both keywords. Append them, separated by a space " ", to s.</li>
432
-
<li>Otherwise, if the first argument to the gradient function was an <angle>, serialize the <angle> and append it to s.</li>
433
-
<li>Otherwise, append "top" to s.</li>
434
-
</ul>
435
-
</li>
436
-
<li>If the first argument to the gradient function was not a color-stop, append a comma and a space ", " to s.</li>
437
-
<li>For each color-stop in the gradient, do the following:
438
-
<ol>
439
-
<li>Serialize the <color>, and append it to s.</li>
440
-
<li>If a <length> or <percentage> was specified, append a space " " to s, then serialize the <length> or <percentage> and append it to s.</li>
441
-
<li>If this is not the final color-stop, append a comma and a space ", " to s.</li>
442
-
</ol>
443
-
</li>
444
-
<li>Append a close parenthesis ")" to s.</li>
445
-
</ol>
446
-
<p>To serialize a radial gradient, let s initially be the empty string, run these steps, and then return s:</p>
447
-
<ol>
448
-
<li>Append "radial-gradient(" to s.</li>
449
-
<li>If a <bg-position> was specified in the first argument to the gradient function, serialize it and append it to s. Otherwise, append "center" to s.</li>
450
-
<li>Append a comma and a space ", " to s.</li>
451
-
<li>
452
-
<ul>
453
-
<li>If a <shape> and/or <size> was specified in the second argument to the gradient function:
454
-
<ol>
455
-
<li>If a <shape> was specified, serialize it as a keyword and append it to s. Otherwise, append "ellipse" to s.</li>
456
-
<li>Append a space " " to s.</li>
457
-
<li>If a <size> was specified, serialize it as a keyword and append it to s. Otherwise, append "cover" to s.</li>
458
-
</ol>
459
-
</li>
460
-
<li>Otherwise, if two <length>s or <percentage>s were specified in the second argument to the gradient function:
461
-
<ol>
462
-
<li>Serialize the first <length> or <percentage> and append it to s.</li>
463
-
<li>Append a space " " to s.</li>
464
-
<li>Serialize the second <length> or <percentage> and append it to s.</li>
465
-
</ol>
466
-
</li>
467
-
<li>Otherwise, append "ellipse cover" to s.</li>
468
-
</ul>
469
-
</li>
470
-
<li>Append a comma and a space ", " to s.</li>
471
-
<li>For each color-stop in the gradient, do the following:
472
-
<ol>
473
-
<li>Serialize the <color>, and append it to s.</li>
474
-
<li>If a <length> or <percentage> was specified, append a space " " to s, then serialize the <length> or <percentage> and append it to s.</li>
475
-
<li>If this is not the final color-stop, append a comma and a space ", " to s.</li>
<p>Gradient images can be interpolated directly in CSS transitions and animations, smoothly animating from one gradient to another. There are only a few restrictions on what gradients are allowed to be interpolated:</p>
<p>To serialize a linear gradient, let s initially be the empty string, run these steps, and then return s:</p>
786
+
<ol>
787
+
<li>Append "linear-gradient(" to s.</li>
788
+
<li>
789
+
<ul>
790
+
<li>If the first argument to the gradient function was a single keyword, serialize the keyword and append it to s.</li>
791
+
<li>Otherwise, if the first argument to the gradient function was two keywords, serialize both keywords. Append them, separated by a space " ", to s.</li>
792
+
<li>Otherwise, if the first argument to the gradient function was an <angle>, serialize the <angle> and append it to s.</li>
793
+
<li>Otherwise, append "top" to s.</li>
794
+
</ul>
795
+
</li>
796
+
<li>If the first argument to the gradient function was not a color-stop, append a comma and a space ", " to s.</li>
797
+
<li>For each color-stop in the gradient, do the following:
798
+
<ol>
799
+
<li>Serialize the <color>, and append it to s.</li>
800
+
<li>If a <length> or <percentage> was specified, append a space " " to s, then serialize the <length> or <percentage> and append it to s.</li>
801
+
<li>If this is not the final color-stop, append a comma and a space ", " to s.</li>
802
+
</ol>
803
+
</li>
804
+
<li>Append a close parenthesis ")" to s.</li>
805
+
</ol>
806
+
<p>To serialize a radial gradient, let s initially be the empty string, run these steps, and then return s:</p>
807
+
<ol>
808
+
<li>Append "radial-gradient(" to s.</li>
809
+
<li>If a <bg-position> was specified in the first argument to the gradient function, serialize it and append it to s. Otherwise, append "center" to s.</li>
810
+
<li>Append a comma and a space ", " to s.</li>
811
+
<li>
812
+
<ul>
813
+
<li>If a <shape> and/or <size> was specified in the second argument to the gradient function:
814
+
<ol>
815
+
<li>If a <shape> was specified, serialize it as a keyword and append it to s. Otherwise, append "ellipse" to s.</li>
816
+
<li>Append a space " " to s.</li>
817
+
<li>If a <size> was specified, serialize it as a keyword and append it to s. Otherwise, append "cover" to s.</li>
818
+
</ol>
819
+
</li>
820
+
<li>Otherwise, if two <length>s or <percentage>s were specified in the second argument to the gradient function:
821
+
<ol>
822
+
<li>Serialize the first <length> or <percentage> and append it to s.</li>
823
+
<li>Append a space " " to s.</li>
824
+
<li>Serialize the second <length> or <percentage> and append it to s.</li>
825
+
</ol>
826
+
</li>
827
+
<li>Otherwise, append "ellipse cover" to s.</li>
828
+
</ul>
829
+
</li>
830
+
<li>Append a comma and a space ", " to s.</li>
831
+
<li>For each color-stop in the gradient, do the following:
832
+
<ol>
833
+
<li>Serialize the <color>, and append it to s.</li>
834
+
<li>If a <length> or <percentage> was specified, append a space " " to s, then serialize the <length> or <percentage> and append it to s.</li>
835
+
<li>If this is not the final color-stop, append a comma and a space ", " to s.</li>
0 commit comments