输入框,css,Css输入框选中效果

css

body {

font-size: 20px;

font-family: system-ui, Helvetica, Arial, sans-serif;

background: #fff;

}

form {

width: 300px;

margin: 20px auto;

}

fieldset {

position: relative;

border: none;

}

label {

position: absolute;

top: 18px;

color: rgba(0, 0, 0, 0.3);

transform-origin: left;

transition: all 0.3s ease;

}

input:focus ~ label {

color: red;

}

input:focus ~ label,

input:valid ~ label {

top: 0;

transform: scale(0.6, 0.6);

}

input {

font-size: 20px;

width: 100%;

border: none;

margin-top: 10px;

}

input:focus {

outline: none;

}

.after {

width: 100%;

height: 2px;

background: linear-gradient(to right, red 50%, transparent 50%);

background-color: rgba(0, 0, 0, 0.3);

background-size: 200% 100%;

background-position: 100% 0;

transition: all 0.6s ease;

}

input:focus ~ .after {

background-position: 0 0;

}

button {

position: relative;

width: 100%;

font-size: 20px;

font-family: system-ui, Helvetica, Arial, sans-serif;

line-height: 1.5;

margin-top: 20px;

padding: 2px 10px;

color: rgba(0, 0, 0, 0.4);

background: white;

border: none;

background: linear-gradient(to right, red 50%, transparent 50%);

background-color: rgba(0, 0, 0, 0.3);

background-size: 200% 100%;

background-position: 100% 0;

transition: all 0.6s ease;

}

button:before {

position: absolute;

content: "Submit";

top: 2px;

bottom: 2px;

left: 2px;

right: 2px;

display: block;

background-color: white;

}

button:active,

button:focus,

button:hover {

outline: none;

background-position: 0 0;

color: red;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值