码迷,mamicode.com
首页 > Web开发 > 详细

H5表单css3滑动动画

时间:2018-06-21 00:03:29      阅读:740      评论:0      收藏:0      [点我收藏+]

标签:tran   transform   color   osi   width   input   label   表单   gre   

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.container{margin: 100px;position: relative;}
input{border:1px solid #999;outline: 0;width: 140px;height: 30px;line-height: 30px;border-radius: 5px;transition: text-indent .3s;text-indent: 36px;}
span.title{position: absolute;left: 2px;top: 1px;height: 30px;line-height: 30px;transition: transform .3s}
input:focus,input:hover{
    text-indent: 2px;
}
input:focus+span.title,input:hover+span.title{
    transform: translateX(-2.2em);
}
input:valid~label::after{content: "正确"}
input:invalid~label::after{content: "错误"}
input:valid{border:1px solid green;}
input:invalid{border:1px solid red;}
</style>
</head>
<body>
    <div class="container">
        <input type="email" id="mail" required placeholder="输入邮箱">
        <span class="title">邮箱</span>
        <label for="mail"></label>
    </div>
</body>
</html>

 

H5表单css3滑动动画

标签:tran   transform   color   osi   width   input   label   表单   gre   

原文地址:https://www.cnblogs.com/island1994/p/9206541.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!