用CSS3如何实现钟摆动画的导航栏菜单效果

我们都知道,CSS3可以实现很多很酷的动画效果,而今天我们将与大家分享一期用CSS3制作的钟摆动画菜单效果,在这个动画中,我们主要采用CSS3来控制SVG图标的左右摆动效果。

首先,我们需要在HTML的head部分引入以下文件:

<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css'> 
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css'> 
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css'>

接着,我们需要创建一个HTML的页面导航栏的结构。

<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CSS3超酷钟摆样式导航菜单</title>
  <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css'>
  <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css'>
  <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css'>
</head>
<body>
  <div class="webqdkf-container">
    <header class="webqdkf-header">
      <h1>CSS3超酷钟摆样式导航菜单</h1>
    </header>
    <div class="container">
  <div class="row mt-5">
      <div class="col-sm-3 col-md-3 box">
        <div class="box1">
          <div class="box1-inner">
            <span class="icon-set i1">
              <a href="http://www.webqdkf.com" target="_blank">
                <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
width="80" height="80"
viewBox="0 0 172 172"
style=" fill:#000000;"><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g fill="#ff6a00"><path d="M101.05,17.2c-4.72427,0 -8.6,3.87573 -8.6,8.6v34.4c0,4.72427 3.87573,8.6 8.6,8.6h10.75v13.79023l13.79023,-13.79023h31.35977c4.72427,0 8.6,-3.87573 8.6,-8.6v-34.4c0,-4.72427 -3.87573,-8.6 -8.6,-8.6zM101.05,21.5h55.9c2.40083,0 4.3,1.89917 4.3,4.3v34.4c0,2.40083 -1.89917,4.3 -4.3,4.3h-33.14023l-7.70977,7.70977v-7.70977h-15.05c-2.40083,0 -4.3,-1.89917 -4.3,-4.3v-34.4c0,-2.40083 1.89917,-4.3 4.3,-4.3zM19.35,27.95c-2.35009,0 -4.3,1.94991 -4.3,4.3v86c0,2.35009 1.94991,4.3 4.3,4.3h49.45v8.6h-6.45c-4.72427,0 -8.6,3.87573 -8.6,8.6v4.3h64.5v-4.3c0,-4.72427 -3.87573,-8.6 -8.6,-8.6h-6.45v-8.6h49.45c2.35009,0 4.3,-1.94991 4.3,-4.3v-43h-4.3v43h-49.45h-34.4h-49.45v-86h66.65v-4.3zM111.8,38.7c-2.37482,0 -4.3,1.92518 -4.3,4.3c0,2.37482 1.92518,4.3 4.3,4.3c2.37482,0 4.3,-1.92518 4.3,-4.3c0,-2.37482 -1.92518,-4.3 -4.3,-4.3zM129,38.7c-2.37482,0 -4.3,1.92518 -4.3,4.3c0,2.37482 1.92518,4.3 4.3,4.3c2.37482,0 4.3,-1.92518 4.3,-4.3c0,-2.37482 -1.92518,-4.3 -4.3,-4.3zM146.2,38.7c-2.37482,0 -4.3,1.92518 -4.3,4.3c0,2.37482 1.92518,4.3 4.3,4.3c2.37482,0 4.3,-1.92518 4.3,-4.3c0,-2.37482 -1.92518,-4.3 -4.3,-4.3zM25.8,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM34.4,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM43,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM51.6,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM60.2,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM68.8,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM77.4,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM86,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM94.6,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM103.2,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM111.8,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM120.4,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM129,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM137.6,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM146.2,105.35c-1.18741,0 -2.15,0.96259 -2.15,2.15c0,1.18741 0.96259,2.15 2.15,2.15c1.18741,0 2.15,-0.96259 2.15,-2.15c0,-1.18741 -0.96259,-2.15 -2.15,-2.15zM73.1,122.55h25.8v8.6h-25.8zM62.35,135.45h47.3c2.40083,0 4.3,1.89917 4.3,4.3h-55.9c0,-2.40083 1.89917,-4.3 4.3,-4.3z"></path></g></g></svg>
              </a>
            </span>
          </div>
        </div>
         <div class="small-box1 color1">
            <div></div>
          </div>

        <div class="text-heading color1">
          <h3>前端开发</h3>
          <p><a href="http://www.webqdkf.com/qdkf/" target="_blank">Web前端开发技术三个要素:HTML、CSS、JavaScript。</a></p>
        </div>
      </div>


      <div class="col-sm-3 col-md-3 box">
        <div class="box2">

          <div class="box1-inner">
            <span class="icon-set i2">
             <a href="http://www.webqdkf.com" target="_blank">
             <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
width="80" height="80"
viewBox="0 0 172 172"
style=" fill:#000000;"><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g fill="#ffbc00"><path d="M68.8,17.2c-4.72832,0 -8.6,3.87168 -8.6,8.6v4.69473c-1.82246,0.64668 -3.25859,2.08281 -3.90527,3.90527h-39.09473v111.8h141.9v-111.8h-39.09473c-0.64668,-1.82246 -2.08281,-3.25859 -3.90527,-3.90527v-4.69473c0,-4.72832 -3.87168,-8.6 -8.6,-8.6zM68.8,21.5h2.74629c0.74746,1.27656 2.11641,2.15 3.70371,2.15h25.8c1.5873,0 2.95625,-0.87344 3.70371,-2.15h2.74629c2.40195,0 4.3,1.89805 4.3,4.3v4.69473c-1.82246,0.64668 -3.25859,2.08281 -3.90527,3.90527h-39.48945c-0.64668,-1.82246 -2.08281,-3.25859 -3.90527,-3.90527v-4.69473c0,-2.40195 1.89805,-4.3 4.3,-4.3zM21.5,38.7h133.3v45.15c0,5.96289 -4.78711,10.75 -10.75,10.75h-111.8c-5.96289,0 -10.75,-4.78711 -10.75,-10.75zM88.15,77.4c-2.37676,0 -4.3,1.92324 -4.3,4.3c0,2.37676 1.92324,4.3 4.3,4.3c2.37676,0 4.3,-1.92324 4.3,-4.3c0,-2.37676 -1.92324,-4.3 -4.3,-4.3zM21.5,94.35645c2.73789,2.79668 6.54238,4.54355 10.75,4.54355h111.8c4.20762,0 8.01211,-1.74687 10.75,-4.54355v47.54355h-133.3zM27.95,98.9c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM148.35,98.9c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM27.95,107.5c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM148.35,107.5c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM27.95,116.1c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM148.35,116.1c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM27.95,124.7c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM148.35,124.7c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM27.95,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM36.55,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM45.15,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM53.75,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM62.35,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM70.95,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM79.55,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM88.15,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM96.75,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM105.35,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM113.95,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM122.55,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM131.15,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM139.75,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM148.35,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15z"></path></g></g></svg>
  </a>
  </span>
          </div>
        </div>
        <div class="small-box1 color2">
            <div></div>
          </div>

          <div class="text-heading color2">
          <h3>前端框架</h3>
          <p><a href="http://www.webqdkf.com/qdkf/" target="_blank">主要以前端各大主流框架学习为主</a></p>
        </div>

      </div>


          <div class="col-sm-3 col-md-3 box">
        <div class="box3">
          <div class="box1-inner">
            <span class="icon-set i3">
             <a href="http://www.webqdkf.com" target="_blank">
              <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
width="80" height="80"
viewBox="0 0 172 172"
style=" fill:#000000;"><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g fill="#06af23"><path d="M86,12.51367l-70.95,44.34375v20.12266l3.29219,-2.05762l1.00781,-0.63828v78.36582h133.3v-78.35742l4.3,2.6875v-20.12266zM86,17.58633l66.65,41.65625v9.98574l-66.65,-41.66465l-66.65,41.66465v-9.98574zM86,32.63633l62.35,38.96875v61.69492c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15v10.75h-43v-10.75c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15v-38.7h-38.7v38.7c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15v10.75h-43v-10.75c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15v-61.70332zM66.65,53.75v25.8h38.7v-25.8zM70.95,58.05h12.9v17.2h-12.9zM88.15,58.05h12.9v17.2h-12.9zM70.95,98.9h30.1v49.45h-30.1zM93.525,122.55c-1.78047,0 -3.225,1.44453 -3.225,3.225c0,1.78047 1.44453,3.225 3.225,3.225c1.78047,0 3.225,-1.44453 3.225,-3.225c0,-1.78047 -1.44453,-3.225 -3.225,-3.225zM32.25,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM40.85,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM49.45,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM58.05,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM113.95,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM122.55,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM131.15,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM139.75,133.3c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15z"></path></g></g></svg>
            </a>
            </span>
          </div>
        </div>
            <div class="small-box1 color3">
            <div></div>
          </div>

            <div class="text-heading color3">
          <h3>网站模板</h3>
          <p><a href="http://www.webqdkf.com/mb/" target="_blank">主要以分享各类网页模板</a></p>
        </div>
      </div>

      <div class="col-sm-3 col-md-3 box">
        <div class="box4">

          <div class="box1-inner">
            <span class="icon-set i4">
             <a href="http://www.webqdkf.com" target="_blank">
              <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
width="80" height="80"
viewBox="0 0 172 172"
style=" fill:#000000;"><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g fill="#06a7af"><path d="M83.85,19.35c-14.88203,0 -28.65547,8.39004 -38.76719,16.60371c-10.12012,8.22207 -16.6625,16.45254 -16.6625,16.45254l-1.80566,2.26758l2.6875,1.0666c0,0 2.20039,0.86504 4.58555,3.48535c2.37676,2.62031 4.8123,6.86152 4.8123,13.87422c0,8.65039 1.49492,15.10879 2.25918,17.88027c-2.56992,1.15899 -4.40918,3.67012 -4.40918,6.63477c0,1.65449 0.5291,3.2502 0.98262,4.80391c0.22676,0.77266 0.45352,1.50332 0.60469,2.06601c0.15117,0.57109 0.20156,1.1002 0.20156,0.86504c0,3.58613 3.04024,6.45 6.63477,6.45h0.17637v0.10918c0,19.92949 14.32774,36.49961 33.23262,40.06895c2.09961,1.68809 4.70313,2.82187 7.61738,2.82187c2.91426,0 5.51777,-1.13379 7.61738,-2.82187c18.90488,-3.56934 33.23262,-20.13945 33.23262,-40.06895v-0.10918h0.17637c3.58613,0 6.63477,-2.86387 6.63477,-6.45c0,0.23516 0.05039,-0.29395 0.20156,-0.86504c0.15117,-0.56269 0.37793,-1.29336 0.60469,-2.06601c0.45351,-1.55371 0.98262,-3.14941 0.98262,-4.80391c0,-2.78828 -1.6377,-5.16504 -3.96406,-6.39961c0.90703,-4.02285 3.96406,-18.08184 3.96406,-27.74004c0,-21.16406 -13.55508,-30.25117 -24.44785,-30.94824c-0.60469,-1.10019 -2.05762,-3.48535 -5.45898,-6.24844c-4.3168,-3.49375 -11.3127,-6.92871 -21.69316,-6.92871zM83.85,23.65c9.44824,0 15.35234,3.01504 18.98047,5.97129c3.62812,2.94785 4.87109,5.68574 4.87109,5.68574l0.57109,1.24297h1.37734c8.75957,0 21.5,6.76914 21.5,26.92539c0,8.85195 -3.09902,23.32246 -3.90527,26.96738c-0.13437,0.05039 -0.26035,0.10078 -0.39473,0.11758v-7.78535c0,-10.7416 -4.3,-17.40156 -8.65879,-21.13047c-4.35039,-3.72051 -8.85195,-4.68633 -8.85195,-4.68633l-1.24297,-0.26035l-0.83145,0.95742c0,0 -2.1416,2.51953 -7.08828,5.20703c-4.94668,2.6959 -12.57246,5.43379 -23.28047,5.43379c-5.25742,0 -12.9084,0.95742 -19.54316,4.45957c-6.13926,3.2502 -11.18672,9.1375 -11.91738,17.87188c-0.04199,-0.0084 -0.07559,-0.0252 -0.11758,-0.03359c-0.38633,-1.19258 -2.31797,-7.5502 -2.31797,-17.49395c0,-8.0373 -2.93945,-13.47949 -5.9377,-16.76328c-1.30176,-1.43613 -2.56992,-2.34316 -3.67012,-3.08223c1.82246,-2.1584 6.4668,-7.525 14.39492,-13.9582c9.73379,-7.91133 22.82695,-15.64629 36.06289,-15.64629zM109.65,40.85c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM109.65,49.45c-1.18418,0 -2.15,0.96582 -2.15,2.15c0,1.18418 0.96582,2.15 2.15,2.15c1.18418,0 2.15,-0.96582 2.15,-2.15c0,-1.18418 -0.96582,-2.15 -2.15,-2.15zM109.42324,61.50176c1.0666,0.31914 3.2334,1.0666 5.97129,3.40976c3.55254,3.04024 7.15547,8.23887 7.15547,17.86348v13.67266l2.95625,-1.18418c1.0582,-0.43672 2.06602,-0.66348 2.41875,-0.66348c1.85605,0 3.225,1.36895 3.225,3.00664v0.0084c0,0.41992 -0.36953,2.09121 -0.80625,3.59453c-0.22676,0.74746 -0.45351,1.48652 -0.63828,2.1584c-0.17637,0.66348 -0.34434,1.15059 -0.34434,1.98203c0,1.16738 -0.97422,2.15 -2.33477,2.15h-4.47637v4.40918c0,18.00625 -12.99238,32.89668 -30.1,35.94531l-0.60469,0.11758l-0.46191,0.41152c-1.44453,1.31855 -3.30898,2.11641 -5.3834,2.11641c-2.07441,0 -3.93887,-0.79785 -5.3834,-2.11641l-0.46191,-0.41152l-0.60469,-0.11758c-17.10762,-3.04863 -30.1,-17.93906 -30.1,-35.94531v-4.40918h-4.47637c-1.36055,0 -2.33477,-0.98262 -2.33477,-2.15c0,-0.83145 -0.16797,-1.31855 -0.35273,-1.98203c-0.18477,-0.67187 -0.40313,-1.41094 -0.62988,-2.1584c-0.43672,-1.50332 -0.80625,-3.17461 -0.80625,-3.59453c0,-1.64609 1.36895,-3.01504 3.225,-3.01504c0.35274,0 1.36055,0.22676 2.41875,0.66348l2.95625,1.18418v-3.82969c0,-8.39844 4.24121,-13.05957 9.91855,-16.05781c5.67734,-2.99824 12.82441,-3.96406 17.52754,-3.96406c11.44707,0 19.82871,-2.95625 25.32969,-5.95449c4.06484,-2.20879 6.12246,-4.08164 7.19746,-5.13984zM68.8,94.6c-2.37676,0 -4.3,1.92324 -4.3,4.3c0,2.37676 1.92324,4.3 4.3,4.3c2.37676,0 4.3,-1.92324 4.3,-4.3c0,-2.37676 -1.92324,-4.3 -4.3,-4.3zM103.2,94.6c-2.37676,0 -4.3,1.92324 -4.3,4.3c0,2.37676 1.92324,4.3 4.3,4.3c2.37676,0 4.3,-1.92324 4.3,-4.3c0,-2.37676 -1.92324,-4.3 -4.3,-4.3z"></path></g></g></svg>
           </a>
            </span>
          </div>
        </div>
        <div class="small-box1 color4">
            <div></div>
          </div>

         <div class="text-heading color4">
          <h3>代码案例</h3>
          <p><a href="http://www.webqdkf.com/tx/" target="_blank">主要分享各种前端代码,网页特效,以及一些功能代码样式</a></p>
        </div>
      </div>


  </div>
</div>
  </div>

  <script src='https://cdnjs.cloudflare.com/ajax/libs/fontawesome-iconpicker/3.2.0/js/fontawesome-iconpicker.min.js'></script>
</body>
</html>

然后,我们为这个HTML文件,添加一些CSS样式,于是就得到了如下CSS代码:

body, html { font-size: 100%;   padding: 0; margin: 0;}
*,*:after,*:before {  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;}
.clearfix:before,.clearfix:after { content: " "; display: table;
}
.clearfix:after {clear: both;}
body{
  background: #222;
  color: #D5D6E2;
  font-weight: 500;
  font-size: 1.05em;
  font-family: "Microsoft YaHei","Segoe UI", "Lucida Grande", Helvetica, Arial,sans-serif;
}
.webqdkf-links a{ color: rgba(255, 255, 255, 0.6);outline: none;text-decoration: none;-webkit-transition: 0.2s;transition: 0.2s;}
.webqdkf-links a:hover,.webqdkf-links a:focus{color:#74777b;text-decoration: none;}
.webqdkf-container{
  margin: 0 auto;
}

.bgcolor-1 { background: #f0efee; }
.bgcolor-2 { background: #f9f9f9; }
.bgcolor-3 { background: #e8e8e8; }
.bgcolor-4 { background: #2f3238; color: #fff; }
.bgcolor-5 { background: #df6659; color: #521e18; }
.bgcolor-6 { background: #2fa8ec; }
.bgcolor-7 { background: #d0d6d6; }
.bgcolor-8 { background: #3d4444; color: #fff; }
.bgcolor-9 { background: #ef3f52; color: #fff;}
.bgcolor-10{ background: #64448f; color: #fff;}
.bgcolor-11{ background: #3755ad; color: #fff;}
.bgcolor-12{ background: #3498DB; color: #fff;}
.bgcolor-20{ background: #494A5F;color: #D5D6E2;}

.webqdkf-header{
  padding: 1em 190px 1em;
  letter-spacing: -1px;
  text-align: center;
  background: #dedede;
}
.webqdkf-header h1 {
  color: #1ab1cc;
  font-weight: 600;
  font-size: 2em;
  line-height: 1;
  margin-bottom: 0;
}
.webqdkf-header h1 span {
  display: block;
  font-size: 60%;
  font-weight: 400;
  padding: 0.8em 0 0.5em 0;
  color: #c3c8cd;
}

.webqdkf-demo a{color: #fff;text-decoration: none;}
.webqdkf-demo{width: 100%;padding-bottom: 1.2em;}
.webqdkf-demo a{display: inline-block;margin: 0.5em;padding: 0.6em 1em;border: 3px solid #fff;font-weight: 700;}
.webqdkf-demo a:hover{opacity: 0.6;}
.webqdkf-demo a.current{background:#1d7db1;color: #fff; }

.webqdkf-links {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  font-size: 1.5em;
  text-align: center;
}

.webqdkf-links::after {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -1px;
  width: 2px;
  height: 100%;
  background: #dbdbdb;
  content: '';
  -webkit-transform: rotate3d(0,0,1,22.5deg);
  transform: rotate3d(0,0,1,22.5deg);
}

.webqdkf-icon {
  display: inline-block;
  margin: 0.5em;
  padding: 0em 0;
  width: 1.5em;
  text-decoration: none;
}

.webqdkf-icon span {
  display: none;
}

.webqdkf-icon:before {
  margin: 0 5px;
  text-transform: none;
  font-weight: normal;
  font-style: normal;
  font-variant: normal;
  font-family: 'icomoon';
  line-height: 1;
  speak: none;
  -webkit-font-smoothing: antialiased;
}


.related {
  color: #fff;
  background: #494A5F;
  text-align: center;
  font-size: 1.25em;
  padding: 0.5em 0;
  overflow: hidden;
}

.related > a {
  vertical-align: top;
  width: calc(100% - 20px);
  max-width: 340px;
  display: inline-block;
  text-align: center;
  margin: 20px 10px;
  padding: 25px;
  font-family: "Microsoft YaHei","宋体","Segoe UI", "Lucida Grande", Helvetica, Arial,sans-serif, FreeSans, Arimo;
}
.related a {
  display: inline-block;
  text-align: left;
  margin: 20px auto;
  padding: 10px 20px;
  opacity: 0.8;
  -webkit-transition: opacity 0.3s;
  transition: opacity 0.3s;
  -webkit-backface-visibility: hidden;
  text-decoration: none;
}

.related a:hover,
.related a:active {
  opacity: 1;
}

.related a img {
  max-width: 100%;
  opacity: 0.8;
  border-radius: 4px;
}
.related a:hover img,
.related a:active img {
  opacity: 1;
}
.related h3{font-family: "Microsoft YaHei", sans-serif;font-size: 1.2em}
.related a h3 {
  font-size: 0.85em;
  font-weight: 300;
  margin-top: 0.15em;
  color: #fff;
}
.icon-webqdkf-home-outline:before {
  content: "\e5000";
}

.icon-webqdkf-arrow-forward-outline:before {
  content: "\e5001";
}

@media screen and (max-width: 1024px) {
  .webqdkf-header {
    padding: 2em 10% 2em;
  }
  .webqdkf-header h1 {
        font-size:1.4em;
    }
    .webqdkf-links{font-size: 1.4em}
}

@media screen and (max-width: 960px) {
  .webqdkf-header {
    padding: 2em 10% 2em;
  }
  .webqdkf-header h1 {
        font-size:1.2em;
    }
    .webqdkf-links{font-size: 1.2em}
    .related h3{font-size: 1em;}
  .related a h3 {
    font-size: 0.8em;
  }
}

@media screen and (max-width: 766px) {
  .webqdkf-header h1 {
        font-size:1.3em;
    }
    .webqdkf-links{font-size: 1.3em}
}

@media screen and (max-width: 640px) {
  .webqdkf-header {
    padding: 2em 10% 2em;
  }
  .webqdkf-header h1 {
        font-size:1em;
    }
    .webqdkf-links{font-size: 1em}
    .related h3{font-size: 0.8em;}
  .related a h3 {
    font-size: 0.6em;
  }
}

.box1
{
  height: 200px;
    width: 200px;
   background-image: linear-gradient(to right bottom, #fd4617, #ff6d12, #ff8d19, #ffaa2c, #ffc445);
    border-radius: 50%;
    border: 10px solid white;
  overflow:hidden;
  margin:auto;
  box-shadow: 11px 11px 12px -9px rgba(27, 14, 0, 0.28);
}

.box2
{
  height: 200px;
    width: 200px;
background-image: linear-gradient(to right bottom, #fff05a, #ffde56, #ffcc55, #ffbb57, #ffaa5a);
  box-shadow: 11px 11px 12px -9px rgba(27, 14, 0, 0.28);
    border-radius: 50%;
    border: 10px solid white;
  overflow:hidden;
  margin:auto;
}

.box3
{
  height: 200px;
    width: 200px;
background: #00b09b;  
background: -webkit-linear-gradient(to right, #96c93d, #00b09b);  
background: linear-gradient(to right, #96c93d, #00b09b);

box-shadow: 11px 11px 12px -9px rgba(27, 14, 0, 0.28);
    border-radius: 50%;
    border: 10px solid white;
  overflow:hidden;
  margin:auto;
}

.box4
{
  height: 200px;
    width: 200px;
background-image: linear-gradient(to right bottom, #3da5d9, #2eb9e4, #29ccec, #38dff1, #54f2f2);
box-shadow: 11px 11px 12px -9px rgba(27, 14, 0, 0.28);
    border-radius: 50%;
    border: 10px solid white;
  overflow:hidden;
  margin:auto;
}
.box1-inner
{
      background-color: #ffffff;
    height: 120px;
    width: 120px;
    border-radius: 50%;
    margin: 31px auto;
    background-image: linear-gradient(to right bottom, #ffffff, #fffefe, #fbfbfb, #f1ecec, #d2d2d2);
    box-shadow: 36px 27px 11px -5px rgba(27, 14, 0, 0.16);
    border: 1px solid #e6e5e4;
  transition:1s;
  cursor:pointer;
  animation: swing ease-in-out .3s infinite alternate;
    transform-origin: top;
    transform-box: fill-box;
    left: calc(42% - .0rem);
}
.box1-inner:hover
{
  box-shadow: -25px 50px 11px -5px rgba(27, 14, 0, 0.16);
  transition:1s;
}

.icon-set
{
      text-align: center;
    width: 100%;
    margin: auto;
    padding-top: 24px;
    float: left;
}

.text-heading
{
  position: absolute;
    top: 230%;
    left: 22%;
}
.text-heading h3
{
  text-transform: uppercase;
    text-align: center;
    font-size: 18px;
}
.text-heading p
{
  text-transform: uppercase;
    text-align: center;
    font-size: 10px;
}
.color1 h3
{
  color: #ff6a00;
}

.color2 h3
{
  color: #ffbc00;

}
.color3 h3
{
  color: #06af23;
}
.color4 h3
{
  color: #06a7af;
}

p a{color:#b2b8b9;}
p a:hover{color:#fff;}

.box1:after,.box2:after,.box3:after,.box4:after
{
  content: '';
    background-color: white;
    height: 200px;
    width: 5px;
    position: absolute;
    left: 50%;
  box-shadow: 1px 3px 6px 1px rgba(0, 0, 0, 0.05);
    z-index: -1;
}

.box1:before,.box2:before,.box3:before,.box4:before
{
  content: '';
    height: 15px;
    width: 15px;
    background-color: white;
    position: absolute;
    border-radius: 50%;
    bottom: -8px;
    left: 48.1%;

}

.small-box1
{
height: 50px;
    width: 50px;
    border-radius: 50%;
    border: 2px solid white;
    position: absolute;
    bottom: -120%;
    left: 41.7%;
  box-shadow: 1px 3px 3px rgba(0, 0, 0, 0.21);
 animation: swing ease-in-out .3s infinite alternate;
    transform-origin: top;
    transform-box: fill-box;
    left: calc(42% - .0rem);
}
.small-box1:after
{
  content: '';
    height: 10px;
    width: 10px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: -7px;
    left: 41.5%;
}
.small-box1 div
{

    height: 30px;
    width: 30px;
    border-radius: 50%;
    margin: auto;
    margin-top: 8px;
  box-shadow: 1px 3px 3px rgba(0, 0, 0, 0.21);
}

.color1 div
{
   background-image: linear-gradient(to right bottom, #fd4617, #ff6d12, #ff8d19, #ffaa2c, #ffc445);
}

.color2 div
{
   background-image: linear-gradient(to right bottom, #fff05a, #ffde56, #ffcc55, #ffbb57, #ffaa5a);
}

.color3 div
{
       background: #00b09b;
    background: -webkit-linear-gradient(to right, #96c93d, #00b09b);
    background: linear-gradient(to right, #96c93d, #00b09b);
}

.color4 div
{
      background-image: linear-gradient(to right bottom, #3da5d9, #2eb9e4, #29ccec, #38dff1, #54f2f2);
}



@keyframes swing {
    0% { transform: rotate(8deg); }
    100% { transform: rotate(-8deg); }
}



@media only screen and (max-width: 1024px)
{

  .box1:after, .box2:after, .box3:after, .box4:after
  {
        height: 172px;
  }

  .small-box1:after
  {
    left: 29.5%;
  }
  .small-box1
  {
        left: calc(40% - .0rem);
  }

  .box1 {
   height: 150px;
    width: 150px;
  }

  .box2 {
  height: 150px;
    width: 150px;
  }

  .box3 {
    height: 150px;
    width: 150px;
  }
  .box4 {
   height: 150px;
    width: 150px;
  }

  .box1-inner
  {
    height: 100px;
    width: 100px;
    margin: 14px auto;
  }

  svg
  {
    width:60%;
  }

  .icon-set
  {
    padding-top: 10px;
  }

  .small-box1
  {
        bottom: -142%;
  }

  .text-heading
  {
    top: 251%;
  }
}
@media only screen and (max-width: 768px)
{
  .small-box1
  {
        left: calc(37% - .0rem);
    bottom: -144%;
  }

  .box1 {
     height: 120px;
    width: 120px;
  }

  .box2 {
        height: 120px;
    width: 120px;
  }

  .box3 {
       height: 120px;
    width: 120px;
  }
  .box4 {
        height: 120px;
    width: 120px;
  }

  .box1-inner
  {
   height: 70px;
    width: 70px;
    margin: 14px auto;
  }

  svg
  {
    width:50%;
  }

  .icon-set
  {
    padding-top: 0px;
  }

  .text-heading h3
  {
        font-size: 14px;
  }

  .box1:after, .box2:after, .box3:after, .box4:after
  {
        height: 140px;
  }

  .text-heading p
  {
    font-size: 8px;
  }

  .text-heading
  {
    top: 251%;
  }
}
@media only screen and (max-width: 425px)
{

  .box
  {
    height: 300px;
        margin-bottom: 30px;
  }
  .small-box1
  {
        left: calc(44% - .0rem);
    bottom: 15%;
  }

  .box1:before, .box2:before, .box3:before, .box4:before
  {
    bottom: 145px;
    left: 48.8%;
  }
  .box1 {
        height: 150px;
    width: 150px;
  }

  .box2 {
        height: 150px;
    width: 150px;
  }

  .box3 {
        height: 150px;
    width: 150px;
  }
  .box4 {
        height: 150px;
    width: 150px;
  }

  .box1-inner
  {
   height: 80px;
    width: 80px;
    margin: 26px auto;
  }

  svg
  {
    width:60%;
  }

  .icon-set
  {
    padding-top: 0px;
  }

  .text-heading h3
  {
        font-size: 14px;
  }

  .box1:after, .box2:after, .box3:after, .box4:after
  {
    height: 60px;
  }

  .text-heading p
  {
    font-size: 8px;
  }

  .text-heading {
    top: 88%;
    left: 35%;
}

  .circle1
  {
        right: 25%;
  }

  .circle2
  {
        right: 16%;
  }

  .circle3
  {
        right: 9%;
  }

}
@media only screen and (max-width: 425px)
{

  .box1:before, .box2:before, .box3:before, .box4:before
  {
        left: 48.7%;
  }

  .small-box1:after
  {
    left: 37%;
  }
}
@media only screen and (max-width: 425px)
{

  @media only screen and (max-width: 425px)
  {
    body
    {
      height: 903vh;
    }
.text-heading {
  left: 30%;
  }
  .small-box1 {
left: calc(43.8% - .0rem);
  }
}

最后,我们将HTML与CSS两部分内容进行组合,通过浏览器预览,就得到了以下动画效果:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值