Get the App
SLTechnology News&Howtos  ›  Development  › 

Case Analysis of deformation and transition of CSS

Shulou Source: shulou.com Published: 2022-06-02 00:02:31 09月30日 Update

This article mainly introduces the relevant knowledge of "case analysis of CSS deformation and transition". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "case analysis of CSS deformation and transition" can help you solve the problem.

1. Transition transition

Transition attribute usage: transition:ransition-propertytransition-durationtransition-timing-functiontransition-delay

It can be specified together or separately.

Transition-property: is the attribute to be transitioned (such as width,height), and all is everything changed.

Transition-duration: time spent in s or ms

Transition-timing-function: specifies the type of animation (motion area curve). There are several motion curves

Ease= > gradually slow down (default) linear= > uniform ease-in= > acceleration ease-out= > deceleration ease-in-out= > acceleration before deceleration

Transition-delay delay time in s or ms

Document

P {

Width:100px

Height:200px

Background-color:aqua

Transition:width3sease-in-out0.5s

}

P:hover {

Width:500px

}

The result is as follows: when the mouse is up, the change is no longer instantaneous, but the transition is complete.

2. Deformable transform

2D deformation

Mobile translate (XBI y)

Move can specify either a pixel value or a percentage, note that the specified percentage is a percentage of its own size, so it can be used to set the center alignment when the box is positioned (move its own-50% after setting left:50%).

Document

P {

Width:100px

Height:100px

Background-color:aqua

Transition:all2s

}

P:active {

Transform:translate (200pxMae 200px)

}

After clicking, the box is moved. The code used to center the positioning box.

Document

.fa {

Width:300px

Height:300px

Background-color:aqua

Transition:all0.5s

Position:relative

}

.son {

Background-color:red

Position:absolute

Left:50%

Top:50%

Width:100px

Height:100px

Transform:translate (- 50% Mo Mo 50%)

}

This is the end of the introduction of "case Analysis of CSS deformation and transition". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Mobile instance case analysis analysis percentage percentage box knowledge unit attribute time curve industry positioning motion difference utility code pixel content Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei OPPO Reno Linux Redmi Docker