CSS3 input框的實現(xiàn)代碼類似Google登錄的動畫效果
發(fā)布時間:2020-08-04 09:43:59 作者:佚名
我要評論
這篇文章主要介紹了CSS3 input框的實現(xiàn)代碼類似Google登錄的動畫效果,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
用css3將input框?qū)懗鲱愃艷oogle登錄頁面的動畫效果
效果一

代碼如下
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;
height: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 ease-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 ease-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>
總結(jié)
到此這篇關于CSS3 input框的實現(xiàn)代碼類似Google登錄的動畫效果的文章就介紹到這了,更多相關CSS3 input框內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持腳本之家!
相關文章
- 這篇文章主要介紹了CSS3中的字體及相關屬性,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2025-06-12
- 本文詳細解析了CSS3中實現(xiàn)賬號密碼輸入框提示特效的原理和方法,包括HTML5的placeholder屬性與CSS3新特性如偽類選擇器、動態(tài)效果和過渡動畫的結(jié)合使用,感興趣的朋友跟隨小2025-05-14
- CSS3的布局特性為前端開發(fā)者提供了無限可能,無論是Flexbox的一維布局還是Grid的二維布局,它們都能夠幫助開發(fā)者以更清晰、簡潔的方式實現(xiàn)復雜的網(wǎng)頁布局,本文給大家介紹C2025-05-14
CSS3 Facebook-style Buttons 項目常見問題及最新解決方案
CSS3 Facebook-style Buttons 是一個開源項目,旨在通過簡單的 CSS 代碼來重現(xiàn) Facebook 按鈕和工具欄的外觀,本文給大家介紹CSS3 Facebook-style Buttons 項目常見問題及2025-05-14使用animation.css庫快速實現(xiàn)CSS3旋轉(zhuǎn)動畫效果
隨著Web技術的不斷發(fā)展,動畫效果已經(jīng)成為了網(wǎng)頁設計中不可或缺的一部分,本文將深入探討animation.css的工作原理,如何使用以及其在實際項目中的應用,感興趣的朋友一起看2025-05-14
CSS3 最強二維布局系統(tǒng)之Grid 網(wǎng)格布局
CS3的Grid網(wǎng)格布局是目前最強的二維布局系統(tǒng),可以同時對列和行進行處理,將網(wǎng)頁劃分成一個個網(wǎng)格,可以任意組合不同的網(wǎng)格,做出各種各樣的布局,本文介紹CSS3 最強二維布局系2025-02-27- 本文介紹了如何使用CSS3的transform屬性和動畫技巧實現(xiàn)波浪式圖片墻,通過設置圖片的垂直偏移量,并使用動畫使其周期性地改變位置,可以創(chuàng)建出動態(tài)且具有波浪效果的圖片墻,同2025-02-27

CSS3模擬實現(xiàn)一個雷達探測掃描動畫特效(最新推薦)
文章介紹了如何使用CSS3實現(xiàn)一個雷達探測掃描的效果,包括夜色背景、蜘蛛網(wǎng)盤、掃描體的轉(zhuǎn)動效果、尾巴陰影以及被掃描到的光點,通過HTML和CSS的配合,實現(xiàn)了豐富的動畫效果,2025-02-21- CSS3的Flexbox是一種強大的布局模式,通過設置display:flex可以輕松實現(xiàn)對齊、排列和分布網(wǎng)頁元素,它解決了傳統(tǒng)布局方法中的對齊、間距分配和自適應布局等問題,接下來通過本2025-02-19

css3 實現(xiàn)icon刷新轉(zhuǎn)動效果
本文給大家介紹css3 實現(xiàn)icon刷新轉(zhuǎn)動效果,文章開頭給大家介紹了webkit-transform、animation、@keyframes這三個屬性,結(jié)合實例代碼給大家介紹的非常詳細,感興趣的朋友一2025-02-19




