一、位移
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
div {
width: 200px;
height: 200px;
background-color: pink;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<div></div>
</body>
</html>
二、缩放
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
div {
width: 200px;
height: 200px;
background-color: pink;
}
div:hover {
transform: scale(0.8);
}
</style>
</head>
<body>
<div></div>
</body>
</html>
三、旋转
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
div {
width: 300px;
height: 300px;
background-color: pink;
margin: 100px auto;
transition: all 0.6s;
transform-origin: right bottom;
}
div:hover {
transform: rotate(360deg);
}
</style>
</head>
<body>
<div>giserDev</div>
</body>
</html>
四、斜切
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
div {
width: 200px;
height: 200px;
background-color: pink;
transform: skew(30deg);
}
</style>
</head>
<body>
<div></div>
</body>
</html>
五、阴影
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
div {
width: 300px;
height: 400px;
background-color: pink;
transition: all 0.6s;
}
div:hover {
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div></div>
</body>
</html>