Transforms Flashcards
What is the transform
CSS property used for?
The transform CSS property is used to modify the position, scale, and rotation of an element, either in 2D or 3D space.
“transform - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 4, 2023.
What is the syntax and possible values for the transform
CSS property?
The syntax for the transform
CSS property is
transform: function(value);
Possible values include functions such as translate
, scale
, rotate
, skew
, and matrix
, each with their respective values.
“transform - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 4, 2023.
How can you apply multiple transforms to an element?
You can apply multiple transform
s by chaining the functions together, separated by spaces, like this:
transform: function1(value) function2(value);
“transform - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 4, 2023.
What are the common 1-dimensional transform
s in CSS?
The common 1-dimensional transforms in CSS are translateX()
, translateY()
, scaleX()
, scaleY()
, and skewX()
, skewY()
.
“transform - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 4, 2023.
What are the main 3-dimensional transform
s in CSS?
The main 3-dimensional transforms in CSS are translate3d(x, y, z)
, scale3d(x, y, z)
, rotateX(angle)
, rotateY(angle)
, rotateZ(angle)
, and matrix3d()
.
“transform - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 4, 2023.
What are the main types of CSS transform functions?
The main types of CSS transforms are translation
, scaling
, rotation
, skewing
, and matrix transformations
.
“transform - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 4, 2023.
What does the translate()
CSS transform function do?
The translation
transform moves an element from its current position along the X, Y, or Z axis without affecting the layout of surrounding elements.
“translate() - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 4, 2023.
What are the syntaxes for translate()
CSS transform functions?
The syntaxes for translation functions in CSS are: translate(tx, ty)
, translateX(tx)
, translateY(ty)
, and translate3d(tx, ty, z)
.
Values:
-
tx - Is a
<length>
or<percentage>
representing the abscissa of the translating vector. -
ty - Is a
<length>
or<percentage>
representing the ordinate of the translating vector. -
tz - Is a
<length>
representing the z component of the translating vector. It can’t be a<percentage>
value; in that case the property containing the transform is considered invalid.
“translate() - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 4, 2023.
What does the scale()
CSS transform do?
The scaling transform resizes an element’s width and height by a specified factor without affecting the layout of surrounding elements.
“scale() - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 5, 2023.
What are the syntaxes for scale()
CSS transform functions?
The syntaxes for scaling functions in CSS are: scale(sx, sy)
, scaleX(sx)
, scaleY(sy)
, and scale3d(sx, sy, sz)
.
Argument values
-
sx - Is a
<number>
representing the abscissa of the scaling vector. -
sy - Is a
<number>
representing the ordinate of the scaling vector. If not defined, its default value is sx, resulting in a uniform scaling that preserves the element’s aspect ratio. -
sz - Is a
<number>
representing the z-component of the scaling vector.
NOTE: scale
, scaleX
and scaleY
also accepts <percentage>
as argument values.
“scale() - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 5, 2023.
What does the rotate()
CSS transform function do?
The rotation transform rotates an element around a specified axis without affecting the layout of surrounding elements.
“rotate() - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 5, 2023.
List all rotate
CSS transform functions
rotate(angle)
, rotateX(angle)
, rotateY(angle)
, rotateZ(angle)
, and rotate3d(x, y, z, angle)
.
What is the syntax of the rotate()
CSS transform function?
rotate(angle);
Values
-
angle - Is an
<angle>
representing the angle of the rotation. The direction of rotation depends on the writing direction. In a left-to-right context, a positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one. In a right-to-left context, a positive angle denotes a counter-clockwise rotation, a negative angle a clockwise one.
“rotate() - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 5, 2023.
What does the skew()
CSS transform function do?
The skew()
CSS function defines a transformation that skews an element on the 2D plane. Its result is a <transform-function>
data type.
“skew() - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 22, 2023.
What is the syntax of the skew()
CSS transform function?
Syntax
skew(ax) skew(ax, ay)
Values
-
ax
- Is an<angle>
representing the angle to use to distort the element along the x-axis (or abscissa). -
ay
- Is an <angle> representing the angle to use to distort the element along the y-axis (or ordinate). If not defined, its default value is 0, resulting in a purely horizontal skewing.</angle>
“skew() - CSS: Cascading Style Sheets | MDN” (developer.mozilla.org). Retrieved May 22, 2023.