首页 > 作文

CSS3 input框的实现代码类似Google登录的动画效果

更新时间:2023-04-03 19:16:14 阅读: 评论:0

用css3将input框写出类似google登录页面的动画效果

效果一

代码如下

css

body{    background-color:#acacac;  }  .form-container{    display: block;    position: relative;    width: 400px;    height: 400px;    background: #fff;    margin: 50px auto;    padding: 30px;  }  input{    display: block;    position: relative;    background: none;    border: 2px solid #acacac;    border-radius:5px;    width: 100%;    font-weight: bold;    padding-left:10px;    font-size: 16px;    h英格兰足球队eight:35px;    z-index: 1;  }  label{    display: inline-block;    position: relative;    top: -32px;    left: 10px;    color: #acacac;    font-size: 16px;    z-index: 2;    transition: all 0.2s ea-out;  }  input:focus, input:valid{ 歌婆节是哪个民族的节日   outline: none;    border: 2px solid #00aced;  }  input:focus + label, input:valid + label{    top: -50px;    font-size: 16px;    color: #00aced;    background-color:#fff;  }

html

<div class="main">    <div class="form-container">      <input type="text" name="input1" required>      <label for="input1">account</三月的英语label>      <input type="text" name="input2" required>      <label for="input2">password</label>    </div>  </div>

效果二

代码如下:

css

body{    background-color:#acacac;  }  .form-container{    display: block;    position: relative;    width: 400px;    background: #fff;    margin: 50px auto;    padding: 60px;  }  input{    display: block;    position: relative;    background: none;    border: none;    border-bottom: 1px solid #ddd;    width: 100%;    font-weight: bold;    font-size: 16px;    z-index: 2;  }  label{    display: block;    position: relative;    top: -20px;    left: 0px;    color: #999;    font-size: 16px;    z-index: 1;    transition: all 0.3s ea-out;    margin-bottom:40px;  }  input:focus, input:valid{    outline: none;    border-bottom: 1px solid #00aced;  }  input:focus + label, input:valid + label{    top: -50px;    font-size: 16px;    color: #00aced;    background-color:#fff;  }小木匠

html

<div class="main">    <div class="form-container">随笔文章      <input type="text" name="input1" required>      <label for="input1">account</label>      <input type="text" name="input2" required>      <label for="input2">password</label>    </div>  </div>

总结

到此这篇关于css3 input框的实现代码类似google登录的动画效果的文章就介绍到这了,更多相关css3 input框内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章,希望大家以后多多支持www.887551.com!

本文发布于:2023-04-03 19:16:13,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/5d3ff8cbf14c658621f825a740fd7c14.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:CSS3 input框的实现代码类似Google登录的动画效果.doc

本文 PDF 下载地址:CSS3 input框的实现代码类似Google登录的动画效果.pdf

标签:效果   代码   文章   类似
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图