Skip to content

Commit 3b5fa27

Browse files
committed
[css-transforms] scale function and property %
Allow percentages inside the scale functions, and the scale property. resolves #3399
1 parent c9ca5ce commit 3b5fa27

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

css-transforms-2/Overview.bs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ which can have additional side-effects in UAs.
629629

630630
<pre class="propdef">
631631
Name: scale
632-
Value: none | <<number>>{1,3}
632+
Value: none | [ <<number>> | <<percentage>> ]{1,3}
633633
Initial: none
634634
Applies to: <a>transformable elements</a>
635635
Inherited: no
@@ -651,6 +651,10 @@ If three values are given,
651651
this specifies a 3d scaling,
652652
equivalent to the ''scale3d()'' function.
653653

654+
A <<percentage>> is equivalent to a <<number>>,
655+
for example ''scale: 100%;'' is equivalent to ''scale: 1;''.
656+
Numbers are used during serialization of specified and computed values.
657+
654658
----
655659

656660
All three properties accept
@@ -894,6 +898,19 @@ The Transform Functions {#transform-functions}
894898
=======================
895899

896900
The value of the 'transform' property is a list of <dfn>&lt;transform-function></dfn>. The set of allowed transform functions is given below. Wherever <<angle>> is used in this specification, a <<number>> that is equal to zero is also allowed, which is treated the same as an angle of zero degrees. A percentage for horizontal translations is relative to the width of the <a>reference box</a>. A percentage for vertical translations is relative to the height of the <a>reference box</a>.
901+
A percentage in a scale function is equivalent to a number, and serializes as a number in specified values.
902+
For example, ''scale3d(50%, 100%, 150%)'' serializes as ''scale3d(0.5, 1, 1.5)''.
903+
904+
2D Transform Functions {#two-d-transform-functions}
905+
----------------------
906+
907+
The scale functions defined in [[!css-transforms-1]] now support percentages.
908+
909+
: <span class='prod'><dfn>scale()</dfn> = scale( [ <<number>> | <<percentage>> ]#{1,2} )</span>
910+
911+
: <span class='prod'><dfn>scaleX()</dfn> = scaleX( [ <<number>> | <<percentage>> ] )</span>
912+
913+
: <span class='prod'><dfn>scaleY()</dfn> = scaleY( [ <<number>> | <<percentage>> ] )</span>
897914

898915
3D Transform Functions {#three-d-transform-functions}
899916
----------------------
@@ -908,9 +925,9 @@ In the following <dfn export>3d transform functions</dfn>, a <<zero>> behaves th
908925
:: specifies a <a href="#Translate3dDefined">3D translation</a> by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively.
909926
: <span class='prod'><dfn>translateZ()</dfn> = translateZ( <<length>> )</span>
910927
:: specifies a <a href="#Translate3dDefined">3D translation</a> by the vector [0,0,tz] with the given amount in the Z direction.
911-
: <span class='prod'><dfn>scale3d()</dfn> = scale3d( <<number>> , <<number>>, <<number>> )</span>
928+
: <span class='prod'><dfn>scale3d()</dfn> = scale3d( [ <<number>> | <<percentage>> ]#{3} )</span>
912929
:: specifies a <a href="#Scale3dDefined">3D scale</a> operation by the [sx,sy,sz] scaling vector described by the 3 parameters.
913-
: <span class='prod'><dfn>scaleZ()</dfn> = scaleZ( <<number>> )</span>
930+
: <span class='prod'><dfn>scaleZ()</dfn> = scaleZ( [ <<number>> | <<percentage>> ] )</span>
914931
:: specifies a <a href="#Scale3dDefined">3D scale</a> operation using the [1,1,sz] scaling vector, where sz is given as the parameter.
915932
: <span class='prod'><dfn>rotate3d()</dfn> = rotate3d( <<number>> , <<number>> , <<number>> , [ <<angle>> | <<zero>> ] )</span>
916933
:: specifies a <a href="#Rotate3dDefined">3D rotation</a> by the angle specified in last parameter about the [x,y,z] direction vector described by the first three parameters. A direction vector that cannot be normalized, such as [0,0,0], will cause the rotation to not be applied.

0 commit comments

Comments
 (0)