登录输入框获取焦点时底部带有从中心向两边滑动的滑动条!
label {
display: block;
position: relative;
}
input {
width: 50%;
border: none;
outline: none;
background: transparent;
border-bottom: 1px solid rgba(27, 52, 136, 0.1);
}
input:focus~.border {
transform: scale(1, 1);
}
.border {
position: absolute;
bottom: 0;
left: 0;
width: 50%;
height: 2px;
background: rgb(153, 21, 21);
transform: scale(0, 1);
transition: 0.2s ease;
}
<div class="formRight">
<form>
<section>
<label>
<p>用户名</p>
<input type="text" placeholder=" ">
<div class="border"></div>
</label>
</section>
</form>
</div>