婷婷久久综合九色综合,欧美成色婷婷在线观看视频,偷窥视频一区,欧美日本一道道一区二区

<tt id="bu9ss"></tt>
  • <span id="bu9ss"></span>
  • <pre id="bu9ss"><tt id="bu9ss"></tt></pre>
    <label id="bu9ss"></label>

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

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

     2020-10-19 11:06  來(lái)源: 腳本之家   我來(lái)投稿 撤稿糾錯(cuò)

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

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

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

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

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

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

    上代碼:

    html:


     
    體 驗(yàn)

     
    »

    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; /* 移動(dòng)130~150px */
        /* 調(diào)用動(dòng)畫 */
        animation-name: arrow_move;
        /* 持續(xù)時(shí)間 */
        animation-duration: 1s;
        /* 無(wú)限播放 */
        animation-iteration-count: infinite;
    }

    效果如下:

    2020070715373977

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

    來(lái)源:腳本之家

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

    申請(qǐng)創(chuàng)業(yè)報(bào)道,分享創(chuàng)業(yè)好點(diǎn)子。點(diǎn)擊此處,共同探討創(chuàng)業(yè)新機(jī)遇!

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

    相關(guān)文章

    熱門排行

    信息推薦