Home > Web Front-end > CSS Tutorial > What is the usage of translate in css3

What is the usage of translate in css3

WBOY
Release: 2021-12-16 18:33:36
Original
7213 people have browsed it

Translate in css is used to define the translation transformation of elements. It can be used in conjunction with the transform attribute. The syntax is "transform:translate(x,y)"; "x" in the translate() function defines the position of the element on the x-axis. The translation distance, "y" defines the translation distance of the element on the y-axis.

What is the usage of translate in css3

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

What is the usage of translate in css3

In css translate is used to define the translation transformation of elements. The translate() function can be used with transform Properties are used together to perform translation operations on elements.

The syntax is:

transform:translate(x,y)
Copy after login

The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
<style> 
.img1{
transform:translate(0,100px);
}
</style>
</head>
<body>
<img  src="1118.02.png" class="img1" alt="What is the usage of translate in css3" >
<img  src="1118.02.png" class="img2" alt="What is the usage of translate in css3" >
</body>
</html>
Copy after login

Output result:

What is the usage of translate in css3

(Learning video Share: css video tutorial)

The above is the detailed content of What is the usage of translate in css3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template