css实现24种输入框focus点击获取焦点线条背景动画效果代码
代码语言:html
所属分类:表单美化
代码描述:css实现24种输入框focus点击获取焦点线条背景动画效果代码
代码标签: 输入 框 focus 点击 获取 焦点 线条 背景 动画 效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<html>
<head>
<style>
/*= Reset CSS
============= */
html, body {
border: 0;
margin: 0;
padding: 0;
}
body {
font: 14px "Lato", Arial, sans-serif;
min-width: 100%;
min-height: 100%;
color: #666;
}
.container {
margin: 0 auto;
max-width: 1200px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.row {
float: left;
width: 100%;
padding: 20px 0 50px;
}
h2 {
text-align: center;
color: #2079df;
font-size: 28px;
float: left;
width: 100%;
margin: 30px 0;
position: relative;
line-height: 58px;
font-weight: 400;
}
h2:before {
content: "";
position: absolute;
left: 50%;
bottom: 0;
width: 100px;
height: 2px;
background-color: #2079df;
margin-left: -50px;
}
/*= Reset CSS End
================= */
body {
background-color: #fff;
}
/*= input focus effects css
=========================== */
:focus {
outline: none;
}
.col-3 {
float: left;
width: 27.33%;
margin: 40px 3%;
position: relative;
}
/* necessary to give position: relative to parent. */
input[type="text"] {
font: 15px/24px "Lato", Arial, sans-serif;
color: #333;
width: 100%;
box-sizing: border-box;
letter-spacing: 1px;
}
.effect-1,
.effect-2,
.effect-3 {
border: 0;
padding: 7px 0;
border-bottom: 1px solid #ccc;
}
.effect-1 ~ .focus-border {
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 2px;
background-color: #3399FF;
transition: 0.4s;
}
.effect-1:focus ~ .focus-border {
width: 100%;
transition: 0.4s;
}
.effect-2 ~ .focus-border {
position: absolute;
bottom: 0;
left: 50%;
width: 0;
height: 2px;
background-color: #3399FF;
transition: 0.4s;
}
.effect-2:focus ~ .focus-border {
width: 100%;
transition: 0.4s;
left: 0;
}
.effect-3 ~ .focus-border {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 2px;
z-index: 99;
}
.effect-3 ~ .focus-border:before,
.effect-3 ~ .focus-border:after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 100%;
background-color: #3399FF;
transition: 0.4s;
}
.effect-3 ~ .focus-border:after {
left: auto;
right: 0;
}
.effect-3:focus ~ .focus-border:before,
.effect-3:focus ~ .focus-border:after {
width.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0