1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      CSS如何實現(xiàn)一個簡單的Loading效果

      這篇文章主要介紹了CSS如何實現(xiàn)一個簡單的Loading效果的相關(guān)知識,內(nèi)容詳細(xì)易懂,操作簡單快捷,具有一定借鑒價值,相信大家閱讀完這篇CSS如何實現(xiàn)一個簡單的Loading效果文章都會有所收獲,下面我們一起來看看吧。

      容城網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)公司,容城網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為容城上千余家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站制作要多少錢,請找那個售后服務(wù)好的容城做網(wǎng)站的公司定做!

      1.使用Animation動畫實現(xiàn)Loading

      Animation是CSS3新增的一個模塊,它可以用來創(chuàng)建非常復(fù)雜的動畫效果。這里我們通過Animation來創(chuàng)建一個Loading的效果。

      首先在HTML中添加一個用于Loading效果的容器:

      
        
        
        

      接下來,在CSS中定義一個關(guān)鍵幀動畫,用于旋轉(zhuǎn)“圓圈”。

      @keyframes rotate {
        0% {
          transform: rotate(0deg);
        }
        100% {
          transform: rotate(360deg);
        }
      }

      然后為.loading-circle類設(shè)置樣式,使其成為一個圓形,并在其中使用上述定義的動畫。

      .loading-circle {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background-color: #333;
        margin: 0 10px;
        animation: rotate 1.5s ease-in-out infinite;
      }

      最后,在.css-loading中設(shè)置容器的樣式,使其居中于頁面,并適當(dāng)調(diào)整“圓圈”的位置和大小。

      .loading {
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .loading-circle:nth-child(1) {
        transform: translateY(-30px);
      }
      .loading-circle:nth-child(2) {
        transform: translateY(30px);
      }

      完整的實現(xiàn)代碼如下:

      @keyframes rotate {
        0% {
          transform: rotate(0deg);
        }
        100% {
          transform: rotate(360deg);
        }
      }
      
      .loading-circle {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background-color: #333;
        margin: 0 10px;
        animation: rotate 1.5s ease-in-out infinite;
      }
      
      .loading {
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .loading-circle:nth-child(1) {
        transform: translateY(-30px);
      }
      .loading-circle:nth-child(2) {
        transform: translateY(30px);
      }

      2.使用Transition過渡實現(xiàn)Loading

      除了Animation之外,我們還可以使用CSS中的Transition來實現(xiàn)Loading效果。

      我們同樣在HTML中添加一個容器作為Loading的展示區(qū)域:

      
        
        
        

      在CSS中,我們?yōu)?loading-circle-2類定義了初始狀態(tài)和最終狀態(tài),并使用Transition來實現(xiàn)狀態(tài)之間的平滑過渡。

      .loading-circle-2 {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background-color: #333;
        margin: 0 10px;
        transform: scale(0);
        transition: transform 0.5s ease 0.2s;
      }
      
      .loading-2 .loading-circle-2:nth-child(1) {
        animation: delay 0.2s linear infinite;
      }
      .loading-2 .loading-circle-2:nth-child(2) {
        animation: delay 0.3s linear infinite;
      }
      .loading-2 .loading-circle-2:nth-child(3) {
        animation: delay 0.4s linear infinite;
      }
      
      @keyframes delay {
        0%, 80%, 100% {
          transform: scale(0);
        }
        40% {
          transform: scale(1);
        }
      }

      最后,我們在.loading-2元素上設(shè)置樣式,使其居中于頁面。

      完整的實現(xiàn)代碼如下:

      .loading-circle-2 {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background-color: #333;
        margin: 0 10px;
        transform: scale(0);
        transition: transform 0.5s ease 0.2s;
      }
      
      .loading-2 .loading-circle-2:nth-child(1) {
        animation: delay 0.2s linear infinite;
      }
      .loading-2 .loading-circle-2:nth-child(2) {
        animation: delay 0.3s linear infinite;
      }
      .loading-2 .loading-circle-2:nth-child(3) {
        animation: delay 0.4s linear infinite;
      }
      
      @keyframes delay {
        0%, 80%, 100% {
          transform: scale(0);
        }
        40% {
          transform: scale(1);
        }
      }
      
      .loading-2 {
        display: flex;
        justify-content: center;
        align-items: center;
      }

      關(guān)于“CSS如何實現(xiàn)一個簡單的Loading效果”這篇文章的內(nèi)容就介紹到這里,感謝各位的閱讀!相信大家對“CSS如何實現(xiàn)一個簡單的Loading效果”知識都有一定的了解,大家如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。


      網(wǎng)頁題目:CSS如何實現(xiàn)一個簡單的Loading效果
      文章轉(zhuǎn)載:http://www.ef60e0e.cn/article/pijode.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        兴义市| 大余县| 平凉市| 万安县| 霍林郭勒市| 百色市| 泰兴市| 洪泽县| 涞水县| 虎林市| 永春县| 滕州市| 彭阳县| 涿鹿县| 芷江| 尖扎县| 西峡县| 桃园县| 房山区| 丹凤县| 余江县| 磐石市| 安泽县| 瑞安市| 江北区| 怀仁县| 昌图县| 视频| 东至县| 北海市| 苏尼特左旗| 利津县| 织金县| 保德县| 临颍县| 沂源县| 义马市| 嘉禾县| 汉阴县| 泰和县| 霸州市|