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

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

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

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

      當(dāng)前位置:首頁 >  站長 >  編程技術(shù) >  正文

      利用div+css3實現(xiàn)一個背景漸變的button按鈕的示例代碼

       2020-10-19 11:06  來源: 腳本之家   我來投稿 撤稿糾錯

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

      這篇文章主要介紹了利用div+css3實現(xiàn)一個背景漸變的button按鈕的示例代碼,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

      隨著目前前端頁面的需求不斷提升,有些場景需要漸變背景的元素。本文利用div和css3新屬性,實現(xiàn)了一個背景漸變的按鈕,具體如下:

      1.background: linear-gradient 背景為漸變色屬性

      2.利用css3中動畫特性animation,實現(xiàn)背景從左至右變化(color_move)

      3.為了實現(xiàn)漸變效果,將background的寬度拉長至400%

      上代碼:

      html:


       
      體 驗

       
      »

      css:

      @keyframes arrow_move {
         /* 開始狀態(tài) */
          0% {
              left: 130px;
          }
       /* 結(jié)束狀態(tài) */
          100% {
              left: 140px;
          }
      }
      @keyframes color_move {
          /* 開始狀態(tài) */
          0% {
              background-position: 0% 0%; /* 水平位置 垂直位置 */
          }
          50% {
              background-position: 50% 0%;
          }
       /* 結(jié)束狀態(tài) */
          100% {
              background-position: 100% 0%;
          }
      }
      .btn_demo {
          width:180px;
          height:60px;
          border-radius: 10px;
          position: relative;
          background: linear-gradient( 90deg, #373d42 0%, #2679dd 50%, #373d42 100%);
          background-size: 400% 100%;
          animation: color_move 5s infinite ease-in-out alternate;
          cursor: pointer;
      }
      .btn_demo:hover {
          background: #2679dd;
      }
      .btn_demo:active {
          background: #373d42;
      }
      .btn_demo > .text {
          /* background: yellow; */
          width: 50px;
          text-align: center;
          position: absolute;
          left: 50%;
          top: 50%;
          transform: translate(-50%,-50%);
          font-size: 20px;
          color: #fff;
          font-weight: bold;
      }
      .btn_demo > .arrow {
          /* background: green; */
          width: 20px;
          text-align: center;
          position: absolute;
          font-size: 30px;
          color: #fff;
          top: 46%;
          transform: translateY(-50%);
          left: 130px; /* 移動130~150px */
          /* 調(diào)用動畫 */
          animation-name: arrow_move;
          /* 持續(xù)時間 */
          animation-duration: 1s;
          /* 無限播放 */
          animation-iteration-count: infinite;
      }

      效果如下:

      2020070715373977

      到此這篇關(guān)于利用div+css3實現(xiàn)一個背景漸變的button按鈕的示例代碼的文章就介紹到這了,更多相關(guān)div+css3背景漸變按鈕內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

      來源:腳本之家

      鏈接:https://www.jb51.net/web/734075.html

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

      相關(guān)標(biāo)簽
      div
      CSS

      相關(guān)文章

      熱門排行

      信息推薦