Strange Menu Background Animation On Hover - CSS Hover Effects - Tutorial

Hôm nay mình sẽ giới thiệu cho các bạn tạo một hiệu ứng Strange Menu Background Animation độc đáo, thường ứng ụng trong các trang landing page.
<ul id="nav-demo">
    <li><a href="">Trang chủ<span></span><span></span><span></span><span></span></a></li>
    <li><a href="">Giới thiệu<span></span><span></span><span></span><span></span></a></li>
    <li><a href="">Dịch vụ<span></span><span></span><span></span><span></span></a></li>
    <li><a href="">Dự án<span></span><span></span><span></span><span></span></a></li>
    <li><a href="">Liên hệ<span></span><span></span><span></span><span></span></a></li>
</ul>

#nav-demo {
    margin:0;
    padding:0;
    &:after,
    &:before {
        content: " ";
        display: table;
    }
    &:after {
        clear: both;
    }
    li {
        float: left;
        list-style: none;
        a {
            display: block;
            text-align: center;
            color:#262626;
            text-transform: uppercase;
            -webkit-transition: .5s;-o-transition: .5s;transition: .5s;
            padding: 10px 15px;
            font-weight: bold;
            position: relative;
            box-sizing: border-box;
            z-index: 1;
            span {
                position: absolute;
                display: block;
                width: 25%;
                height: 100%;
                background-color: #262626;
                top:0;
                z-index: -1;
                -webkit-transform: scaleY(0);
                -ms-transform: scaleY(0);
                transform: scaleY(0);
                -webkit-transform-origin: top;
                -ms-transform-origin: top;
                        transform-origin: top;
                -webkit-transition: -webkit-transform 0.5s ease-in-out;
                transition: -webkit-transform 0.5s ease-in-out;
                -o-transition: transform 0.5s ease-in-out;
                transition: transform 0.5s ease-in-out;
                transition: transform 0.5s ease-in-out, -webkit-transform 0.5s ease-in-out;
                &:nth-child(1) {
                    left: 0;
                    -webkit-transition-delay: 0s;
                         -o-transition-delay: 0s;
                            transition-delay: 0s;
                }
                &:nth-child(2) {
                    left: 25%;
                    -webkit-transition-delay: 0.1s;
                         -o-transition-delay: 0.1s;
                            transition-delay: 0.1s;
                }
                &:nth-child(3) {
                    left: 50%;
                    -webkit-transition-delay: 0.15s;
                         -o-transition-delay: 0.15s;
                            transition-delay: 0.15s;
                }
                &:nth-child(4) {
                    left: 75%;
                    -webkit-transition-delay: 0.2s;
                         -o-transition-delay: 0.2s;
                            transition-delay: 0.2s;
                }

            }
        }
        &:hover {
            a {
                color: #fff;
                span {
                    -webkit-transform-origin: bottom;
                    -ms-transform-origin: bottom;
                    transform-origin: bottom;
                    -webkit-transform: scaleY(1);
                    -ms-transform: scaleY(1);
                            transform: scaleY(1);

                }
            }
        }
    }
}
@media screen and (max-width: 450px) {
    #nav-demo {
        li {
            float: none;
        }
    }
}

0 thảo luận về Strange Menu Background Animation On Hover - CSS Hover Effects - Tutorial

comment_blank
Hãy để lại #comment của bạn mình sẽ giải đáp thắc mắc một cách sớm nhất có thể.

Bài viết cùng chuyên mục