input后面::before ::after 无效

今天本来想用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
后来查找资料发现 一个选择器只能使用一个伪元素,并且伪元素必须处于选择器语句的最后

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值