Skip to content

Commit 93243e5

Browse files
authored
Merge pull request #4396 from ewilligers/scale-percentage
[css-transforms] scale function and property %
2 parents bb803b0 + 3b5fa27 commit 93243e5

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
@@ -645,7 +645,7 @@ which can have additional side-effects in UAs.
645645

646646
<pre class="propdef">
647647
Name: scale
648-
Value: none | <<number>>{1,3}
648+
Value: none | [ <<number>> | <<percentage>> ]{1,3}
649649
Initial: none
650650
Applies to: <a>transformable elements</a>
651651
Inherited: no
@@ -667,6 +667,10 @@ If three values are given,
667667
this specifies a 3d scaling,
668668
equivalent to the ''scale3d()'' function.
669669

670+
A <<percentage>> is equivalent to a <<number>>,
671+
for example ''scale: 100%;'' is equivalent to ''scale: 1;''.
672+
Numbers are used during serialization of specified and computed values.
673+
670674
----
671675

672676
All three properties accept
@@ -910,6 +914,19 @@ The Transform Functions {#transform-functions}
910914
=======================
911915

912916
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>.
917+
A percentage in a scale function is equivalent to a number, and serializes as a number in specified values.
918+
For example, ''scale3d(50%, 100%, 150%)'' serializes as ''scale3d(0.5, 1, 1.5)''.
919+
920+
2D Transform Functions {#two-d-transform-functions}
921+
----------------------
922+
923+
The scale functions defined in [[!css-transforms-1]] now support percentages.
924+
925+
: <span class='prod'><dfn>scale()</dfn> = scale( [ <<number>> | <<percentage>> ]#{1,2} )</span>
926+
927+
: <span class='prod'><dfn>scaleX()</dfn> = scaleX( [ <<number>> | <<percentage>> ] )</span>
928+
929+
: <span class='prod'><dfn>scaleY()</dfn> = scaleY( [ <<number>> | <<percentage>> ] )</span>
913930

914931
3D Transform Functions {#three-d-transform-functions}
915932
----------------------
@@ -924,9 +941,9 @@ In the following <dfn export>3d transform functions</dfn>, a <<zero>> behaves th
924941
:: 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.
925942
: <span class='prod'><dfn>translateZ()</dfn> = translateZ( <<length>> )</span>
926943
:: specifies a <a href="#Translate3dDefined">3D translation</a> by the vector [0,0,tz] with the given amount in the Z direction.
927-
: <span class='prod'><dfn>scale3d()</dfn> = scale3d( <<number>> , <<number>>, <<number>> )</span>
944+
: <span class='prod'><dfn>scale3d()</dfn> = scale3d( [ <<number>> | <<percentage>> ]#{3} )</span>
928945
:: specifies a <a href="#Scale3dDefined">3D scale</a> operation by the [sx,sy,sz] scaling vector described by the 3 parameters.
929-
: <span class='prod'><dfn>scaleZ()</dfn> = scaleZ( <<number>> )</span>
946+
: <span class='prod'><dfn>scaleZ()</dfn> = scaleZ( [ <<number>> | <<percentage>> ] )</span>
930947
:: specifies a <a href="#Scale3dDefined">3D scale</a> operation using the [1,1,sz] scaling vector, where sz is given as the parameter.
931948
: <span class='prod'><dfn>rotate3d()</dfn> = rotate3d( <<number>> , <<number>> , <<number>> , [ <<angle>> | <<zero>> ] )</span>
932949
:: 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)