效果图:

CSS3书写三角形_css3

源代码:

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

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
position: relative;
width: 248px;
height: 33px;
border: 1px solid #000;
}

div::after {
position: absolute;
right: 7px;
top: 7px;
content: " ";
width: 10px;
height: 10px;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
transform: rotate(45deg);
transition: all ease .5s;
}

div:hover::after {
transform: rotate(225deg);
}
</style>
</head>

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

</html>