乐趣区

关于css:旋转中心点案例

<!DOCTYPE html>
<html lang=”en”>

<head>
<meta charset=”UTF-8″>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title> 旋转中心点案例 </title>
<style>

div {
  width: 200px;
  height: 200px;
  border: 1px solid pink;
  margin: 10px;
  float: left;
  overflow: hidden;
}

div::after {
  content: '黑马';
  display: block;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: hotpink;
  transform: rotate(90deg);
  transform-origin: left bottom;
  transition: all .7s;
}

/* 鼠标通过 div   外面的 before 还原 */
div:hover::after {transform: rotate(0);
}

</style>
</head>

<body>
<div></div>
<div></div>
<div></div>
<div></div>
</body>

</html>

退出移动版