css3實現的使用者登入表單程式碼例項
分享一段簡單的程式碼例項,它實現了簡單的表單使用者登入效果。
並且具有一些css3實現的效果,比如滑鼠點選文字框底部會出現動畫條效果。
程式碼例項如下:
[HTML] 純文字檢視 複製程式碼<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://www.softwhy.com/" /> <title>螞蟻部落</title> <style type="text/css" media="screen"> body { padding: 0px; margin: 0px; } ul,li,a { padding: 0px; margin: 0px; list-style: none; } .sign { max-width: 20rem; min-width: 15rem; margin: 2.4rem auto; color: #333; } .sign .section { background-color: #fff; border: 1px solid #ececec; border-radius: 2px; padding: 2rem 2.5rem; } .sign .section.form { width: 100%; height: 15rem; } .form-item { position: relative; width: 100%; height: auto; margin-bottom: 1.5rem; border-bottom: 1px solid #ececec; } .form-item:first-child { margin-bottom: 1rem; } .form-item:last-child { border: none; } .form-item input { margin: 0.5rem 0.4rem; font-size: 0.73rem; border: none; outline: none; box-shadow: none; -webkit-box-shadow: none; width: calc(100% - 70px); } .form-item .bot-bar { position: relative; height: 1px; width: 100%; } .bot-bar:before { position: absolute; bottom: -1px; left: 50%; content: ""; height: 1px; width: 0px; background-color: #1B76C5; box-shadow: 1px 1px 3px rgba(255, 255, 255, 0.3); transition: width ease-in-out .35s; -moz-transition: width ease-in-out .35s; -o-transition: width ease-in-out .35s; -webkit-transition: width ease-in-out .35s; } .bot-bar:after { position: absolute; bottom: -1px; right: 50%; content: ""; height: 1px; width: 0px; background-color: #1B76C5; transition: width ease-in-out .35s; -moz-transition: width ease-in-out .35s; -o-transition: width ease-in-out .35s; -webkit-transition: width ease-in-out .35s; } .form-item h2 { text-align: center; color: #5474db; } .form-item input:focus ~ .bot-bar:before { width: 50%; } .form-item input:focus ~ .bot-bar:after { width: 50%; } .form-item .icon { margin: 0.5rem 0.5rem; color: #5474db; } .form-item .info { color: red; position: absolute; right: 0px; font-size: 0.71rem; } .form-submit { position: relative; text-align: center; background-color: #617fde; border-radius: 5px; overflow: hidden; padding: 0.3rem; color: aliceblue; letter-spacing: 0.1rem; cursor: pointer; line-height: 1.6rem; font-size: 0.7rem; height: 1.6rem; transition: all ease-in-out .35s; -moz-transition: all ease-in-out .35s; -o-transition: all ease-in-out .35s; -webkit-transition: all ease-in-out .35s; } .form-submit:hover { font-size: 0.9rem; background-color: #5474db; } .icon-mobile-phone:before { font-size: 2rem; } .icon-user-md:before { font-size: 1.2rem; } .form-submit:before { font-size: 0.9rem; position: absolute; top: 0px; left: 0px; content: attr(data-txt); background-color: #617fde; width: 100%; line-height: 2.2rem; letter-spacing: 0.1rem; overflow: hidden; text-align: center; height: 1.1rem; transition: top ease-in-out .35s; -moz-transition: top ease-in-out .35s; -o-transition: top ease-in-out .35s; -webkit-transition: top ease-in-out .35s; } .form-submit:hover:before { top: -1.1rem; } .form-submit:after { font-size: 0.9rem; position: absolute; bottom: 0px; left: 0px; content: attr(data-txt); background-color: #617fde; width: 100%; line-height: 1px; letter-spacing: 0.1rem; overflow: hidden; text-align: center; height: 1.1rem; transition: bottom ease-in-out .35s; -moz-transition: bottom ease-in-out .35s; -o-transition: bottom ease-in-out .35s; -webkit-transition: bottom ease-in-out .35s; } .form-submit:hover:after { bottom: -1.1rem; } </style> </head> <body> <div class="sign"> <div class="section"> <form id="form"> <div class="form-item"> <h2>登入主題</h2> </div> <div class="form-item"> <i class="icon-user-md icon"></i> <input v-model="user.name" type="text" class="form-input" name="name" placeholder="使用者姓名"> <div class="bot-bar"></div> </div> <div class="form-item"> <i class="icon-mobile-phone icon"></i> <input v-model="user.phone" type="text" class="form-input" name="phone" placeholder="電話號碼"> <div class="bot-bar"></div> </div> <div class="form-item"> <i class="icon-envelope icon"></i> <input v-model="user.email" type="text" class="form-input" name="email" placeholder="電子郵箱"> <div class="bot-bar"></div> </div> <div class="form-item"> <div class="form-submit" data-txt="Login"> Login </div> </div> </form> </div> </div> </body> </html>
相關文章
- MongoDB 6.0 單例項基於使用者角色實現授權登入MongoDB單例
- JWT實現登入認證例項JWT
- html實現簡單ListViews效果的例項程式碼HTMLView
- JavaScript 表單驗證程式碼例項JavaScript
- HTML 使用表單標籤實現註冊頁面的例項程式碼HTML
- CSS3立體導航選單程式碼例項CSSS3
- CSS3卡通形象程式碼例項CSSS3
- css3水滴效果程式碼例項CSSS3
- python 單一程式例項 實現Python
- css3晃動效果程式碼例項CSSS3
- CSS3心形效果程式碼例項CSSS3
- CSS3發光背景程式碼例項CSSS3
- CSS3旋轉效果程式碼例項CSSS3
- CSS3紙飛機程式碼例項CSSS3
- CSS3滑過光束效果程式碼例項CSSS3
- CSS3小黃人效果程式碼例項CSSS3
- CSS3圖層陰影程式碼例項CSSS3
- css3折角效果程式碼例項CSSS3
- CSS3梯形效果程式碼例項CSSS3
- CSS3背景漸變效果程式碼例項CSSS3
- CSS3星系運動效果程式碼例項CSSS3
- Vue.js實現可配置的登入表單Vue.js
- Python實現簡單網頁圖片抓取完整程式碼例項Python網頁
- CSS3文字凹凸效果程式碼例項CSSS3
- JSP程式設計實現簡單使用者7天內免登入及示例程式碼JS程式設計
- CSS3 translate導致字型模糊的例項程式碼CSSS3
- 一起來實現單使用者登入 —— 功能實現
- 單例模式 – 單例登錄檔與 Spring 實現單例剖析單例模式Spring
- HTML6實現摺疊選單與手風琴選單的例項程式碼HTML
- 實現單項鍊表
- vuejs實現新增tag標籤程式碼例項VueJS
- 例項程式碼分享Python實現Linux監控PythonLinux
- Laravel5.6 實現後臺管理登入(自定義使用者表登入)Laravel
- canvas載入效果程式碼例項Canvas
- CSS3文字陰影效果程式碼例項CSSS3
- table表頭分組程式碼例項
- JSP程式設計實現使用者自動登入功能示例程式碼JS程式設計
- oauth2.0實現sso單點登入的方式和相關程式碼OAuth
- PHP 完整表單例項PHP單例