龙空技术网

input表单输入框聚焦动画特效

莫等闲闲闲 55

前言:

此时朋友们对“htmlinputclass”都比较着重,姐妹们都想要了解一些“htmlinputclass”的相关文章。那么小编同时在网络上搜集了一些对于“htmlinputclass””的相关资讯,希望看官们能喜欢,朋友们一起来学习一下吧!

表单动画1html源码

<div class="inputBox">    <input class="effect-1" type="text" placeholder="Placeholder Text">    <span class="focus-border">        <i></i>    </span></div>
css源码

inputBox class类用于布局,就是一个input容器,便于观看,我这里设置每一行分为3个列(可根据自己需求设置)。

.inputBox {      float: left;      width: 27.33%;      margin: 40px 3%;      position: relative; }       

然后为input元素设置一些通用样式。

input[type="text"]{    font: 15px/24px "Lato", Arial, sans-serif;     color: #333;     width: 100%;     box-sizing: border-box;     letter-spacing: 1px;}    :focus{  outline: none;}

effect-1 class类就代表着不同的input表单获取焦点的动画样式种类, effect-1就代表第一种,以此类推。

.effect-1{    border: 1px solid #ccc;     padding: 7px 14px 9px;     transition: 0.4s;}.effect-1 ~ .focus-border:before,.effect-1 ~ .focus-border:after{    content: "";     position: absolute;     top: 0;     right: 0;     width: 0;     height: 2px;     background-color: #3399FF;     transition: 0.2s;     transition-delay: 0.2s;}.effect-1 ~ .focus-border:after{    top: auto;     bottom: 0;     right: auto;     left: 0;     transition-delay: 0.6s;}.effect-1 ~ .focus-border i:before,.effect-1 ~ .focus-border i:after{    content: "";     position: absolute;     top: 0;     left: 0;     width: 2px;     height: 0;     background-color: #3399FF;     transition: 0.2s;}.effect-1 ~ .focus-border i:after{    left: auto;     right: 0;     top: auto;     bottom: 0;     transition-delay: 0.4s;}.effect-1:focus ~ .focus-border:before,.effect-1:focus ~ .focus-border:after{    width: 100%;     transition: 0.2s;     transition-delay: 0.6s;}.effect-1:focus ~ .focus-border:after{    transition-delay: 0.2s;}.effect-1:focus ~ .focus-border i:before,.effect-1:focus ~ .focus-border i:after{    height: 100%;     transition: 0.2s;}.effect-1:focus ~ .focus-border i:after{    transition-delay: 0.4s;}

表单动画2html源码

<div class="inputBox">    <input class="effect-2" type="text" placeholder="Placeholder Text">    <span class="focus-border">        <i></i>    </span></div>
css源码
.effect-2{    border: 1px solid #ccc;     padding: 7px 14px 9px;     transition: 0.4s;}.effect-2 ~ .focus-border:before,.effect-2 ~ .focus-border:after{    content: "";     position: absolute;     top: 0;     left: 0;     width: 0;     height: 2px;     background-color: #3399FF;     transition: 0.3s;}.effect-2 ~ .focus-border:after{    top: auto;     bottom: 0;     left: auto;     right: 0;}.effect-2 ~ .focus-border i:before,.effect-2 ~ .focus-border i:after{    content: "";     position: absolute;     top: 0;     left: 0;     width: 2px;     height: 0;     background-color: #3399FF;     transition: 0.4s;}.effect-2 ~ .focus-border i:after{    left: auto;     right: 0;     top: auto;     bottom: 0;}.effect-2:focus ~ .focus-border:before,.effect-2:focus ~ .focus-border:after{    width: 100%;     transition: 0.3s;}.effect-2:focus ~ .focus-border i:before,.effect-2:focus ~ .focus-border i:after{    height: 100%;     transition: 0.4s;}

表单动画3html源码

<div class="inputBox">    <input class="effect-3" type="text" placeholder="Placeholder Text">    <span class="focus-border">        <i></i>    </span></div>
css源码
.effect-3{    border: 1px solid #ccc;     padding: 7px 14px 9px;     transition: 0.4s;}.effect-7 ~ .focus-border:before,.effect-7 ~ .focus-border:after{    content: "";     position: absolute;     top: 0;     left: 50%;     width: 0;     height: 2px;     background-color: #3399FF;     transition: 0.4s;}.effect-7 ~ .focus-border:after{    top: auto;     bottom: 0;}.effect-7 ~ .focus-border i:before,.effect-7 ~ .focus-border i:after{    content: "";     position: absolute;     top: 50%;     left: 0;     width: 2px;     height: 0;     background-color: #3399FF;     transition: 0.6s;}.effect-7 ~ .focus-border i:after{    left: auto;     right: 0;}.effect-7:focus ~ .focus-border:before,.effect-7:focus ~ .focus-border:after{    left: 0;     width: 100%;     transition: 0.4s;}.effect-7:focus ~ .focus-border i:before,.effect-7:focus ~ .focus-border i:after{    top: 0;     height: 100%;     transition: 0.6s;}

搬你想搬,盖你所需,码字不易,且行且珍惜!

标签: #htmlinputclass