css大會網站頂部的一個特效,css大會網站特效

來源:互聯網
上載者:User

css大會網站頂部的一個特效,css大會網站特效

看到http://css.w3ctech.com/ 上一個效果覺得挺贊的。

然後學些了一下。

demo地址:http://codepen.io/tianzi77/pen/mJaLWq

html結構很簡單,就是一個p,2個span標籤嵌套在a標籤裡面。

    <a href="/" class="link-mallki">            思君子兮未敢言 zhuangjia             <span data-letters="思君子兮未敢言 zhuangjia"></span>            <span data-letters="思君子兮未敢言 zhuangjia"></span>          </a>

樣式有點複雜,總體是利用動畫,偽類hover前後的樣式進行變化出現炫酷的效果:

        body {            background: black;        }        a {            display: inline-block;            font-size: 60px;            margin: 30px 0 20px;        }        [class*="link-"] {            outline: none;            text-decoration: none;            position: relative;            line-height: 1;            display: inline-block;        }        .link-mallki {            color:#fff;            -webkit-transition: color 0.5s 0.25s;            transition: color 0.5s 0.25s;            overflow: hidden;        }        .link-mallki:hover {            -webkit-transition: none;            transition: none;            color: transparent;        }        .link-mallki::before {            content: '';            width: 100%;            height: 2px;            margin: -3px 0 0 0;            background: #fff;            position: absolute;            left: 0;            top: 50%;            -webkit-transform: translate3d(-100%, 0, 0);            transform: translate3d(-100%, 0, 0);            -webkit-transition: -webkit-transform 0.4s;            transition: transform 0.4s;            -webkit-transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);            transition-timing-function: cubic-bezier(0.7, 0, 0.3, 1);        }        .link-mallki:hover::before {            -webkit-transform: translate3d(100%, 0, 0);            transform: translate3d(100%, 0, 0);        }        .link-mallki span {            position: absolute;            height: 50%;            width: 100%;            left: 0;            top: 0;            overflow: hidden;        }        .link-mallki span::before {            content: attr(data-letters);            position: absolute;            left: 0;            width: 100%;            color: #abcdef;            -webkit-transition: -webkit-transform 0.5s;            transition: transform 0.5s;        }        .link-mallki span:nth-child(2) {            top: 50%;        }        .link-mallki span:first-child::before {            top: 0;            -webkit-transform: translate3d(0, 100%, 0);            transform: translate3d(0, 100%, 0);        }        .link-mallki span:nth-child(2)::before {            bottom: 0;            -webkit-transform: translate3d(0, -100%, 0);            transform: translate3d(0, -100%, 0);        }        .link-mallki:hover span::before {            -webkit-transition-delay: 0.3s;            transition-delay: 0.3s;            -webkit-transform: translate3d(0, 0, 0);            transform: translate3d(0, 0, 0);            -webkit-transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);            transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);        }

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.