<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
div{
200px;
height: 35px;
border: 2px solid gray;
/*父相*/
position: relative;
}
/*用after实现只要一个div*/
div::after{
content: '';
/*子绝:相对于父元素进行绝对定位*/
position: absolute;
top: 3px;
right:15px;
/*定个宽高*/
15px;
height: 15px;
/*只要下边和右边*/
border-bottom:2px solid gray;
border-right: 2px solid gray;
/*旋转45度,形成下三角*/
transform:rotate(45deg);
/*旋转时要有个过渡效果*/
transition:all 2s;
}
/*鼠标经过div里面的after进行旋转45+180=225deg*/
div:hover::after{
transform: rotate(225deg);
}
</style>
<body>
<div></div>
</body>
</html>