Home  >  Article  >  Web Front-end  >  What does css3 scale mean?

What does css3 scale mean?

青灯夜游
青灯夜游Original
2022-03-15 15:57:455042browse

In CSS3, scale means "scaling" and is a built-in function used in the transform attribute. It is used to perform 2D or 3D scaling transformation on the specified element; there are many scale functions, including: scale(), scaleX(), scaleY(), scaleZ(), scale3d().

What does css3 scale mean?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

In CSS3, scale means "zooming" and is a built-in function used in the transform attribute.

There are many scale functions for the transform attribute:

  • scale()

  • scaleX()

  • scaleY()

  • ##scaleZ()

  • ##scale3d()
  • What changes is not the width and height of the element, but the scale of the X and Y axes

scaleX(), scaleY() Scale For this element, >1 zooms in, <1 zooms out. The default value is 1;

Looking at the picture above, you may feel that 100px has become 200px But actually, it's not. What changes is not the width and height of the element.

In fact, what he changes is not the width and height of the element, but the scale of the x and y axes↓

scale()This is a combination of the above two, that is, the first parameter is x and the second is y

##scale3d()

The first parameter is x and the second parameter is y The third parameter is z, which is the combination of scalex scaley scalez.

scalez, this value is originally 3D, so it may be a bit difficult to understand. Like the picture above, it is originally a 2D picture. No matter how you stretch its Z axis, you will not see the effect. . The premise is that your drawing can only be stretched if it is 3D, but cannot be stretched if it is 2D. If there are friends who don’t know where the Z axis is, please click here→rotateZ

Explore:

First, let’s think about a question, If you use rotate to rotate, the X and Y axes will change with the rotation. If you add scaleX and Y at this time, will there be a scale effect during the rotation?

Let’s first observe the effect of rotating first and then scale:

After reading the above picture, do you think that when rotating, it will bring The effect of scale rotates together. but! If you change the two positions, the results will be completely different. First scale and then rotate

Compare the two pictures, and you will find that, The effect of the first picture is indeed rotated with the scale effect. Why is it different when the position is changed?

Actually, rotating first and then scaling (first rotating, then scaling) will bring the effect of rotation, but first scaling and then rotating (first scaling, then rotating) will not bring the effect of scaling. The rotating and zooming effects will stay in place and will take effect when you pass by. Look at the illustration below, the zoomed ratio will stay in place, and when passing by, the ratio will be restored.

(Learning video sharing: css video tutorial

,

web front-end)

The above is the detailed content of What does css3 scale mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn