最新下载
西山居首页jQuery焦点图代码
CSS3扁平化风格联系表单
24小时阅读排行榜
- 1 Golang在Service Mesh中扮演什么角色_数据面开发说明
- 2 javascript如何实现实时通信?_掌握javascript WebSocket应用【教程】
- 3 如何存储javascript数据_localStorage和sessionStorage有何区别【教程】
- 4 Laravel Blade组件如何实现代码复用? (class与匿名组件)
- 5 numpy 如何用 np.where 多条件嵌套实现 if-elif-else 逻辑
- 6 javascript能做什么_它有哪些应用场景【教程】
- 7 如何正确处理切片重切(re-slicing)以避免内存泄漏
- 8 SQL 如何设计审计字段?
- 9 如何使用Golang实现微服务日志收集_Golang微服务日志管理技巧
- 10 javascript闭包在实际中如何应用【教程】
- 11 SQL 使用窗口函数实现去重保留最新记录
- 12 如何在Golang中测试结构体字段验证_Golang reflect与testing结合实践
- 13 Linux 僵尸进程是如何产生的?
- 14 如何实现可折叠容器的平滑高度过渡动画
- 15 如何使用 CSS 为表格行(tr)实现圆角背景与渐变色条形图效果
最新教程
-
- Node.js 教程
- 16075 2025-08-28
-
- CSS3 教程
- 1546447 2025-08-27
-
- Rust 教程
- 23221 2025-08-27
-
- Vue 教程
- 25688 2025-08-22
-
- PostgreSQL 教程
- 22179 2025-08-21
-
- Git 教程
- 9166 2025-08-21
html,
body {
background-color: #F4F4F4;
display: flex;
width: 100%;
height: 100%;
align-items: center;
font-family: "Work Sans", sans-serif;
justify-content: center;
}
.exp-container {
width: 100%;
padding: 30px;
box-sizing: border-box;
max-width: 600px;
}
.exp {
display: flex;
flex-direction: column-reverse;
width: 100%;
margin-bottom: 30px;
position: relative;
flex-wrap: wrap;
}
.exp__label {
transition: 0.3s;
margin-bottom: 5px;
}
.exp__label:before {
content: attr(data-icon);
font-weight: normal;
font-family: "Ionicons";
font-size: 24px;
position: absolute;
left: 0;
transform: rotateY(90deg);
bottom: 0;
height: 52px;
background: transparent;
color: #000;
transform-origin: left;
display: flex;
align-items: center;
justify-content: center;
transition: color .3s 0s ease, transform .3s 0s ease;
width: 42px;
}
.exp__input {
border: 1px solid #ddd;
padding: 0 10px;
width: 100%;
height: 52px;
transition: 0.3s;
font-weight: normal;
box-sizing: border-box;
font-family: "Work Sans", sans-serif;
outline: none;
}
.exp__input:focus {
padding-left: 42px;
border-color: #bbb;
}
.exp__input:focus + label:before {
transform: rotateY(0deg);
}
.exp__input:valid {
padding-left: 42px;
border-color: green;
}
.exp__input:valid + label {
color: green;
}
非常简单的一款带动画效果的CSS3表单输入框验证代码,当输入框聚焦时出现图标动画,还有验证邮箱地址格式是否正确等功能。
