国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

15158846557 在線咨詢 在線咨詢
15158846557 在線咨詢
所在位置: 首頁 > 營銷資訊 > 網(wǎng)站運營 > 淺談css當(dāng)中:focus-within的好玩之處

淺談css當(dāng)中:focus-within的好玩之處

時間:2024-02-23 23:55:02 | 來源:網(wǎng)站運營

時間:2024-02-23 23:55:02 來源:網(wǎng)站運營

淺談css當(dāng)中:focus-within的好玩之處:

這篇文章主要介紹了css中:focus-within,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

相信有些人看到過這個B站輸入密碼就遮眼睛的這個圖

這里我們用:focus-within玩一把

布局是這樣的

外面有一個ctn 可以忽略,就是一個居中固定位置而已

xPassword在沒點擊之前里面的“suo”這個圖是隱藏的

xPassword 同級屁股后的“r6m”此時是顯示的

當(dāng)我們一點擊xPassword后同級第一張圖‘r6m’隱藏

:focus-within ~ img的 ~ 這個符號是同級屁股后第一個的意思

同時xPassword里面的一張圖‘suo’的這個display為顯示!這時就成了你輸密碼我就裝作看不見

 

<div class="ctn">

<div class="xPassword">
<input type="password" placeholder="請輸入密碼" class="input">
<img src="http://suo.im/5UnnjN" alt="">
</div>

<img src="http://r6m.cn/csAC" alt="">

</div>

.ctn {
position: relative;
width: 318px;
margin: 100px auto;
height: 370px;
padding: 20px;
box-sizing: border-box;
background: #fff;
z-index: 10;
box-shadow: 0 0 15px #cfcfcf;

}
.ctn h2 {
font-size: 20px;
font-weight: bold;
margin-bottom: 30px;
}
.ctn input {
padding: 10px;
width: 100%;
border: 1px solid #e9e9e9;
border-radius: 2px;
outline: none;
box-sizing: border-box;
font-size: 16px;
}
img {
position: absolute;
top: -23%;
left: 50%;
width: 80px;
height: auto;
transform: translate(-50%, 0);
}

.xPassword img {
display: none;
width: 103px;
height: auto;
top: -26%;
}

//以上毫無價值,可以忽略,下方兩個才是重點

 

.xPassword:focus-within ~ img {
display: none;
}

.xPassword:focus-within img {
display: block;
}

文章來源:腳本之家,原文鏈接:https://www.jb51.net/css/744059.html

關(guān)鍵詞:淺談

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點擊下載Chrome瀏覽器
關(guān)閉