2D conversion module in HTML and CSS

php中世界最好的语言
Release: 2018-03-13 11:36:14
Original
1721 people have browsed it

This time I will bring you the 2D conversion module in HTML and CSS. What are theprecautionsfor the 2D conversion module in HTML and CSS. The following is a practical case, let's take a look.

1. 2D conversion module

2D conversion module

/*where deg is the unit, representing how many degrees*/
transform: rotate(45deg);/*
First parameter: Horizontal direction
Second parameter: Vertical direction
*/transform: translate(100px, 0px);/*
First parameter: Horizontal direction
Two parameters: vertical direction
Note:
If the value is 1, it means no change
If the value is greater than 1, it means it needs to be enlarged
If the value is less than 1, it means it needs to be reduced
If the horizontal and vertical scaling are the same, then it can be abbreviated as a parameter
*//*transform: scale(0.5, 0.5);*/transform: scale(1.5);/*
Note:
1. If multiple transformations are required, separate them with spaces.
2. The 2D transformation module will modify the coordinate system of the element, so the translation after rotation is not a horizontal translation.
*/transform: rotate(45deg ) translate(100px, 0px);


2D conversion module

2D conversion module in HTML and CSS

##2. 2D conversion module- Deformation center point

By default, all elements rotate based on their own center point. We can modify its reference point through the deformation center point attribute

/* 第一个参数:水平方向 第二个参数:垂直方向 注意点 取值有三种形式 具体像素 百分比 特殊关键字 */ /*transform-origin: 200px 0px;*/ /*transform-origin: 50% 50%;*/ /*transform-origin: 0% 0%;*/ /*transform-origin: center center;*/ transform-origin: left top;
Copy after login


2D conversion module in HTML and CSS

3. Perspective attribute (perspective: 500px;) and rotation axis (transform: rotateY(45deg);)

1.perspective: 500px ;

1.1 What is perspective

Near large and far small

1.2. Notes

Be sure to note that the perspective attribute must be added to the object that needs to render near large Above the parent element of the far-small effect element

2.transform: rotateY(45deg);

Which axis do you want to rotate around, then you only need to add which axis after rotate;

Code example:

   95-2D转换模块-旋转轴向  
  • ![](images/rotateZ.jpg)
  • ![](images/rotateX.jpg)
  • ![](images/rotateY.jpg)
Copy after login


2D conversion module in HTML and CSS

4. Poker practice

   96-2D转换模块-练习  

![](images/pk.png)

Copy after login



2D conversion module in HTML and CSS

5. Photo Wall

   97-2D转换模块-相片墙  
  • ![](images/1.jpg)
  • ![](images/2.jpg)
  • ![](images/3.jpg)
  • ![](images/4.jpg)
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

The layout of web pages and clearing floats

The layout of web pages and floating

HTML and CSS box model

CSS background and sprites

The above is the detailed content of 2D conversion module in HTML and CSS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!