CSS input 蛮好看的
<div class="wrap-input100 validate-input m-t-85 m-b-35"> <input class="input100" type="text" id="username" name="username" placeholder="用户名"> <span class="focus-input100"></span> </div>

/*------------------------------------------------------------------ [ Input ]*/ .wrap-input100 { width: 100%; position: relative; border-bottom: 2px solid #d9d9d9; } .input100 { font-family: Poppins-SemiBold; font-size: 16px; color: #555555; /*line-height: 1.2;*/ display: block; width: 100%; height: 35px; background: transparent; padding: 0 5px; } /*---------------------------------------------*/ .focus-input100 { position: absolute; display: block; width: 100%; height: 100%; top: 0; left: 0; pointer-events: none; } .focus-input100::before { content: ""; display: block; position: absolute; bottom: -2px; left: 0; width: 0; height: 2px; -webkit-transition: all 0.4s; -o-transition: all 0.4s; -moz-transition: all 0.4s; transition: all 0.4s; background: #7765ff; } .focus-input100::after { font-family: Poppins-Medium; font-size: 18px; color: #999999; line-height: 1.2; content: attr(data-placeholder); display: block; width: 100%; position: absolute; top: 15px; left: 0px; padding-left: 5px; -webkit-transition: all 0.4s; -o-transition: all 0.4s; -moz-transition: all 0.4s; transition: all 0.4s; } .input100:focus + .focus-input100::after { top: -20px; font-size: 15px; } .input100:focus + .focus-input100::before { width: 100%; } .has-val.input100 + .focus-input100::after { top: -20px; font-size: 15px; } .has-val.input100 + .focus-input100::before { width: 100%; }
.p-t-85 { padding-top: 10px; } .p-b-70 { padding-bottom: 35px; } .m-t-85 { margin-top: 15px; }
本文来自博客园,作者:咸瑜,转载请注明原文链接:https://www.cnblogs.com/bi-hu/p/16015775.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)