国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

【源碼】有點(diǎn)小酷的input輸入框動(dòng)畫(huà)

2022-04-27 21:41 作者:艾恩小灰灰  | 我要投稿

HTML5+CSS3實(shí)現(xiàn)有點(diǎn)小酷的input輸入框動(dòng)畫(huà),帶動(dòng)畫(huà)的輸入框,總是讓人忍不住去點(diǎn)它。

先看效果:

源代碼:

HTML

<div class="wrapper">
 ?<div class="input-data">
 ? ?<input type="text" required>
 ? ?<div class="underline"></div>
 ? ?<label>您的姓名</label>
 ?</div>
</div>

CSS

*{
 ? ?margin: 0;
 ? ?padding: 0;
 ? ?outline: none;
 ? ?/* 這個(gè)是告訴瀏覽器:你想要設(shè)置的邊框和內(nèi)邊距的值是包含在總寬高內(nèi)的 */
 ? ?box-sizing: border-box;
}
body{
 ? ?/* 彈性布局 水平垂直居中 */
 ? ?display: flex;
 ? ?align-items: center;
 ? ?justify-content: center;
 ? ?/* 設(shè)置body最小高度為100%窗口高度 */
 ? ?min-height: 100vh;
 ? ?/* 漸變背景 */
 ? ?background: linear-gradient(200deg,#0c3483,#a2b6df);
}
.wrapper{
 ? ?width: 450px;
 ? ?background-color: #fff;
 ? ?/* 內(nèi)邊距(上下左右) */
 ? ?padding: 40px;
 ? ?/* 盒子陰影 */
 ? ?box-shadow: 0px 0px 10px rgba(0,0,0,0.1);
 ? ?border-radius: 8px;
}
.wrapper .input-data{
 ? ?/* 相對(duì)定位 */
 ? ?position:relative;
 ? ?width: 100%;
 ? ?height: 40px;
}
.wrapper .input-data input{
 ? ?width: 100%;
 ? ?height: 100%;
 ? ?border:none;
 ? ?font-size: 17px;
 ? ?border-bottom: 2px solid #c0c0c0;
}
/* 輸入框獲得焦點(diǎn)時(shí) */
.wrapper .input-data input:focus ~ label,
/* 輸入框的值為合法時(shí) */
.wrapper .input-data input:valid ~ label{
 ? ?/* label上移,同時(shí)改變字號(hào)、顏色 */
 ? ?transform: translateY(-25px);
 ? ?font-size: 15px;
 ? ?color: #2c6fdb;
}
.wrapper .input-data label{
 ? ?position: absolute;
 ? ?bottom:10px;
 ? ?left: 0px;
 ? ?color: #808080;
 ? ?/* 點(diǎn)擊label可以穿透到輸入框 */
 ? ?pointer-events: none;
 ? ?/* 給動(dòng)畫(huà)添加過(guò)渡,不會(huì)太過(guò)生硬 */
 ? ?transition: all 0.3s ease;
}
.wrapper .input-data .underline{
 ? ?position: absolute;
 ? ?bottom: 0px;
 ? ?height: 2px;
 ? ?width: 100%;
 ? ?background-color: #2c6fdb;
 ? ?/* 沿X軸放大 */
 ? ?transform: scaleX(0);
 ? ?/* 動(dòng)畫(huà)過(guò)渡 */
 ? ?transition: all 0.3s ease;
}
.wrapper .input-data input:focus ~ .underline,
.wrapper .input-data input:valid ~ .underline{
 ? ?/* 沿X軸縮小 */
 ? ?transform: scaleX(1);
}


【源碼】有點(diǎn)小酷的input輸入框動(dòng)畫(huà)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
望江县| 广西| 剑川县| 庆阳市| 钟山县| 沂源县| 石门县| 清涧县| 南阳市| 卢龙县| 延寿县| 南通市| 仁布县| 临西县| 乡城县| 海原县| 会同县| 昭通市| 杭锦旗| 静乐县| 宾阳县| 通山县| 安平县| 合山市| 清水县| 牡丹江市| 凤庆县| 林芝县| 铜山县| 奉节县| 房产| 长乐市| 沾化县| 札达县| 白玉县| 株洲县| 烟台市| 阿克陶县| 巴青县| 山阴县| 武汉市|