zoukankan      html  css  js  c++  java
  • 37.1拓展之按钮特效

    在线地址:https://scrimba.com/c/cWqNNnC2

    HTML code:

    <nav>
       <ul>
          <li>one</li>
          <li>two</li>
          <li>three</li>
       </ul>
    </nav>

    CSS code:

    html, body {
        margin: 0;
        padding: 0;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: black
    }
    nav ul li{
        color: white;
        list-style: none;
        font-size: 24px;
        text-transform: uppercase;
        margin-top: 1em;
        padding: 1em 3em;
        border: 1px solid white;
        border-radius: 0.2em;
    }
    nav ul li:nth-of-type(1):hover{
        color: blue;
        border-color: blue;
        box-shadow: 0 0 0 3px blue;
    }
    nav ul li:nth-of-type(2):hover{
        color: blue;
        /* animation-fill-mode : none | forwards | backwards | both;
           forwards 当动画完成后,保持最后一个属性值.
        */
        animation: border-change 1s linear forwards;
    }
    @keyframes border-change{
        0%{
            border-top-color: white;
        }
        25%{
            border-top-color: blue;
        }
        50%{
            border-top-color: blue;
            border-right-color: blue;
        }
        75%{
            border-top-color: blue;
            border-right-color: blue;
            border-bottom-color: blue;
        }
        100%{
            border-color: blue;
        }
    }
    nav ul li:nth-of-type(3){
        color: white;
        transition: 
                border-top-color linear 0.2s 0s,
                border-right-color linear 0.2s 0.2s,
                border-bottom-color linear 0.2s 0.4s,
                border-left-color linear 0.2s 0.6s;  
    }
    nav ul li:nth-of-type(3):hover{
        color: blue;
        border-top-color: blue;
        border-right-color: blue;
        border-bottom-color: blue;
        border-left-color: blue;
        /* 动画名称 进行时间 速度快慢 开始时间 */
        animation: pulse 1s linear 0.8s;
    }
    @keyframes pulse {
        from {
            /* rgb(30, 144, 255) = dodgerblue */
            box-shadow: 0 0 rgba(30, 144, 255, 0.5);
        }
        to {
            box-shadow: 0 0 0 1em rgba(30, 144, 255, 0);
        }
    }
  • 相关阅读:
    ab(http)与abs(https)压测工具
    Q_DECLARE_PRIVATE与Q_DECLARE_PUBLIC
    QMetaObject::connectSlotsByName
    使用QStringBuilder进行字符串连接
    源码必须是UTF-8,QString需要它
    Qt开发中文显示乱码
    qDebug 的使用
    qt 4.6 qmake Reference
    qmake-variable-reference
    Qt学习网站
  • 原文地址:https://www.cnblogs.com/FlyingLiao/p/10409782.html
Copyright © 2011-2022 走看看