1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        「HTML+CSS」--自定義加載動畫【005】

        共 3064字,需瀏覽 7分鐘

         ·

        2021-04-09 13:32

        Part1簡介

        昵稱:海轟

        標(biāo)簽:程序猿一只|C++選手|學(xué)生

        簡介:因C語言結(jié)識編程,隨后轉(zhuǎn)入計算機專業(yè),有幸拿過國獎、省獎等,已保研。目前正在學(xué)習(xí)C++/Linux(真的真的太難了~)

        學(xué)習(xí)經(jīng)驗:扎實基礎(chǔ) + 多做筆記 + 多敲代碼 + 多思考 + 學(xué)好英語!

        Part2效果展示

        Part3Demo代碼

        HTML

        <!DOCTYPE html>
        <html lang="en">

        <head>
            <meta charset="UTF-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <link rel="stylesheet" href="style.css">
            <title>Document</title>
        </head>

        <body>
            <section>
                <span class="loader-1"></span>
            </section>
        </body>

        </html>

        CSS

        html,body{
          margin0;
          height100%;
        }
        body{
          display: flex;
          justify-content: center;
          align-items: center;
          background#263238;
        }
        section {
            width650px;
            height300px;
            padding10px;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            border2px solid red;
        }
        .loader-1 {
          width 96px;
          height96px;
          background: orange;
          border10px solid #FFF;
          border-bottom-color#FF3D00;
          border-radius50%;
          display: inline-block;
          animation: rotation 1s linear infinite;
        }
        @keyframes rotation {
          0% { transformrotate(0deg) }
          100% { transformrotate(360deg) }
        }

        Part4原理詳解

        步驟1:生成一個邊長為96px的正方形

        css代碼

         width : 96px;
          height: 96px;
          backgroundorange;

        效果圖如下

        步驟2:設(shè)置該正方形的border

        css代碼

        border: 10px solid #FFF;

        效果圖如下

        • 橙色部分還是96px??96px,因為border寬度為10px,所以使得span實際大小為116??116px

        步驟3:設(shè)置下邊框為紅色(重點?。?/span>

        css代碼

         border-bottom-color#FF3D00;//設(shè)置下邊框顏色

        效果圖如下

        步驟4:設(shè)置border-radious=50%,將正方形變成圓形

        步驟5:設(shè)置動畫,繞中心一直旋轉(zhuǎn)

        css代碼

        animationrotation 1s linear infinite;
        // 動畫實現(xiàn) 
        @keyframes rotation {
          0% { 
           transformrotate(0deg
          }
          100% { 
           transformrotate(360deg
          }
        }

        效果圖如下

        Part5結(jié)語

        學(xué)習(xí)來源:

        https://codepen.io/bhadupranjal/pen/vYLZYqQ

        文章僅作為學(xué)習(xí)筆記,記錄從0到1的一個過程。希望對您有所幫助,如有錯誤歡迎小伙伴指正~

        Part6系列文章

        「HTML+CSS」--自定義按鈕樣式【004】
        「HTML+CSS」--自定義按鈕樣式【003】
        「HTML+CSS」--自定義按鈕樣式【002】
        「HTML+CSS」--自定義按鈕樣式【001】

        我是海轟?(?ˊ?ˋ)?,如果您覺得寫得可以的話,請點個贊吧

        寫作不易 「點贊」+「收藏」+「在看」

        謝謝支持??

        寫留言|查看留言

        瀏覽 27
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            国产精品久久久久久妇女瘾之手 | 麻豆搭讪av新婚之夜被迷 | 都市激情国产 | 色骚导航 | 午夜成人精品 | 无遮挡的网站 | 天天干天天综合 | 青青青草娱乐 | 飘花影院午夜伦片理伦片 | 永久免费看A片无码网站20 |