乱码乱a∨中文字幕,在线免费激情视频,亚洲欧美久久夜夜潮,国产在线网址

  1. <sub id="hjl7n"></sub>

    1. <sub id="hjl7n"></sub>

      <legend id="hjl7n"></legend>

      當前位置:首頁 >  IDC >  服務(wù)器 >  正文

      淺談css當中:focus-within的好玩之處

       2020-10-16 14:15  來源: 腳本之家   我來投稿 撤稿糾錯

        阿里云優(yōu)惠券 先領(lǐng)券再下單

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

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

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

      布局是這樣的

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

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

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

      當我們一點擊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

      申請創(chuàng)業(yè)報道,分享創(chuàng)業(yè)好點子。點擊此處,共同探討創(chuàng)業(yè)新機遇!

      相關(guān)標簽
      CSS

      相關(guān)文章

      熱門排行

      信息推薦