<!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>css3三角图标</title>
<style>
div {
overflow: hidden;
width: 200px;
height: 200px;
border: 1px solid #000;
margin: 10px;
float: left;
}
/* 利用伪元素实现三角图标 */
div::before {
/* 默认为行元素 */
content: "心愿";
display: block;
width: 100%;
height: 100%;
transform-origin: left bottom;
transform: rotate(180deg);
transition: all 0.4s;
background-color: hotpink;
}
/* 鼠标经过盒子内部,实现三角图标的旋转效果 */
div:hover::before{
/* 180 + 45 */
transform: rotate(0deg);
}
</style>
</head>
<body>
<div ></div>
<div></div>
<div></div>
</body>
</html>