<!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>
/* 移動盒子的位置: 定位 盒子的外邊距 2d轉換移動 */
div {
width: 200px;
height: 200px;
background-color: pink;
/* x就是x軸上移動位置 y 就是y軸上移動位置 中間用逗號分隔*/
/* transform: translate(x, y); */
/* transform: translate(100px, 100px); */
/* 1. 我們如果只移動x坐標 */
/* transform: translate(100px, 0);
transform: translateX(100px); */
/* 2. 我們如果只移動y坐標 */
transform: translate(0, 100px);
transform: translateY(100px);
}
div:first-child {
transform: translate(30px, 30px);
}
div:last-child {
background-color: purple;
}
</style>
</head>
<body>
<div></div>
<div></div>
</body>
</html>