今天本来想用input 做个 带倒三角的 当时想用伪类会比较方便 就用input ::after 发现没有效果
<style>
.box {
margin-left: 10px;
height: 50px;
width: 210px;
box-sizing: border-box;
position: relative;
}
.box::after {
transition: all 0.1s;
transform: rotate(45deg);
left: 185px;
top: 10px;
position: absolute;
content: '';
width: 10px;
height: 10px;
border: 1px solid #000;
border-top: none;
border-left: none;
}
.box:hover::after {
transform: rotate(225deg);
top: 20px;
}
input {
width: 210px;
height: 40px;
box-sizing: border-box;
border-radius: 10px;
}
</style>
</head>
<body>
<div class="box">
<input type="text" />
</div>
</body>
在给input里加翻转效果的时候 发现 用.box::after::hover 添加效果是无效的 后来只能改成.box:hover ::after
后来查找资料发现 一个选择器只能使用一个伪元素,并且伪元素必须处于选择器语句的最后