css 3D菜单[HTML \ CSS]

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 3D菜单[HTML \ CSS]相关的知识,希望对你有一定的参考价值。

<div class="container">
    <div class="row menu">
        <div class="col menu__item">
            <a href="#" class="menu__link" data-name="Главная">Главная</a>
        </div>
    </div>
</div>


.menu {
    list-style: none;
    margin: 50px auto;
    padding: 0;
    max-width: 600px;
    width: 100%;
    text-align: center;
    background-color: #fff;
    display: flex;
}

.menu__item {
    flex-basis: 20%;
}
.menu__link{
    font-size: 0;
    line-height: 26px;
    color: #fff;
    text-decoration: none;
    display: block;
    padding: 10px 0;
    background-color: #000;
    position: relative;
}
.menu__link::before {
    content: attr(data-name);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 10px 0;
    font-size: 16px;
    background-color: blueviolet;
    transform: rotateX(90deg) translateY(46px);
    transform-origin: 50% 100%;
    transition-duration: 500ms;
    transition-property: transform;
}

.menu__link:hover::before {
    transform: rotateX(0deg) translateY(0);
}

.menu__link::after {
    content: attr(data-name);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 10px 0;
    font-size: 16px;
    background-color: #000;
    transform: rotateX(0deg) translateY(0);
    transform-origin: 50% 0;
    transition-duration: 500ms;
    transition-property: transform;
}
.menu__link:hover::after {
    transform: rotateX(90deg) translateY(-46px);
}

以上是关于css 3D菜单[HTML \ CSS]的主要内容,如果未能解决你的问题,请参考以下文章

CSS3 iPhone样式的3D菜单

CSS3 3D折叠菜单导航

帅气的各种html5菜单,你喜欢哪个?

jquery实现简易大气3D导航下拉菜单菜单栏效果

jQuery鼠标悬停3d菜单展开动画

CSS3 3D Transform