A brief analysis of the differences and functions between transition, transform, and translate in CSS3

A brief analysis of the differences and functions between transition, transform, and translate in CSS3

transform and translate

Transform refers to transformation and deformation. It is a CSS3 attribute, just like other width and height attributes.

translate is the attribute value of transform, which means that the element is transformed in 2D. 2D transformation means that the element moves in the direction of the x-axis and in the direction of the y-axis from the current position (0,0).

For example:

transform: translate(0,100%) means moving the element downward along the y-axis from its current position by the entire height of the element.

transform: translate(-20px,0) means moving 20px to the left along the x-axis from the current position of the element

transform has many other property values, translate3D (3D transformation), scale (2D scaling) and other transformation methods.

transition

transition is the animation process of changing one set of CSS properties to another set of properties within a certain period of time. Can be used to achieve dynamic effects, css3 properties

Syntax transition: The property to be transformed The time required to transform Control the speed of the animation Change The delay time after which the animation starts to execute

The transition property is written in the initial style, not in the ending style, which is the style that defines the appearance of the element before the animation starts. You only need to set a transition on an element once, and the browser will take care of animating from one style to another.

For example:

transition:width 2s;

transition:translate 2s;

Transtion: all 2s.

Summarize

This concludes this article about the differences and functions of transition, transform, and translate in CSS3. For more relevant css3 transition, transform, and translate content, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope that everyone will support 123WORDPRESS.COM in the future!

<<:  Conflict resolution when marquee and flash coexist in a page

>>:  Vue implements small notepad function

Recommend

Why node.js is not suitable for large projects

Table of contents Preface 1. Application componen...

IDEA configuration process of Docker

IDEA is the most commonly used development tool f...

Detailed explanation of Docker Swarm service orchestration commands

1. Introduction Docker has an orchestration tool ...

How to automatically delete records before a specified time in Mysql

About Event: MySQL 5.1 began to introduce the con...

XHTML tutorial, a brief introduction to the basics of XHTML

<br />This article will briefly introduce yo...

Summary of how to use bootstrap Table

This article shares with you how to use bootstrap...

MySQL DATE_ADD and ADDDATE functions add a specified time interval to a date

MySQL DATE_ADD(date,INTERVAL expr type) and ADDDA...

Solve the problem that the time zone cannot be set in Linux environment

When changing the time zone under Linux, it is al...

How to get the real path of the current script in Linux

1. Get the real path of the current script: #!/bi...

SQL Optimization Tutorial: IN and RANGE Queries

Preface "High Performance MySQL" mentio...

JS implements a stopwatch timer

This article example shares the specific code of ...

Comparison of the advantages of vue3 and vue2

Table of contents Advantage 1: Optimization of di...

How to change the default character set of MySQL to utf8 on MAC

1. Check the character set of the default install...