day20-CSS-2D转换模块

2017-06-02  本文已影响12人  喵鸢

2D转换模块

2D转换模块--形变中心点

2D转换模块--旋转轴向

透视属性

照片墙

盒子阴影和文字阴影

练习--翻转菜单

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>翻转菜单</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        ul{
            list-style: none;
            text-align: center;
        }
        .fisrt-list{
            width: 680px;
            height: 50px;
            background-color: cornflowerblue;
            margin: 0 auto;
            margin-top: 100px;


        }
        .fisrt-list li {
            width: 200px;
            /*这里不能省略,否则内容会撑起二级菜单的高度*/
            height: 50px;
            line-height: 50px;
            float: left;
            background-color: pink;
            margin-left: 20px;
            position: relative;
        }
        .second-list{
            margin-left: -20px;
            /*不能设置在二级菜单的li上,增大z-index需定位流设置在其父元素身上*/
            position: absolute;
        }
        .second-list li{
            transform: rotateY(180deg);
            background-color: lemonchiffon;
            left: 0;
            top: 0;
            transition: all 1s;
            /*透明度可以让二级菜单看不见,而不是不存在*/
            opacity: 0;
            /*不能设置display这样transform会失效*/
            /*display: none;*/
        }
        .fisrt-list li:hover .second-list li{
            /*display: inline-block;*/
            opacity: 1;
            transform: none;
        }

        .fisrt-list li:hover .second-list li:nth-child(1){
            transition-delay: 0ms;
        }
        .fisrt-list li:hover .second-list li:nth-child(2){
            transition-delay: 200ms;
        }
        .fisrt-list li:hover .second-list li:nth-child(3){
            transition-delay: 400ms;
        }
        .fisrt-list li:hover .second-list li:nth-child(4){
            transition-delay: 600ms;
        }
        .fisrt-list li:hover .second-list li:nth-child(5){
            transition-delay: 800ms;
        }
        .second-list li:nth-child(1){
            transition-delay: 800ms;
        }
        .second-list li:nth-child(2){
            transition-delay: 600ms;
        }

        .second-list li:nth-child(3){
            transition-delay: 400ms;
        }
        .second-list li:nth-child(4){
            transition-delay: 200ms;
        }
        .second-list li:nth-child(5){
            transition-delay: 0ms;
        }
        div{
            width: 680px;
            height: 300px;
            background-color: red;
            margin: 0 auto;
        }

    </style>
</head>
<body>
<ul class="fisrt-list">
    <li>一级菜单
        <ul class="second-list">
            <li>二级菜单</li>
            <li>二级菜单</li>
            <li>二级菜单</li>
            <li>二级菜单</li>
            <li>二级菜单</li>
        </ul>
    </li>
    <li>一级菜单
        <ul class="second-list">
            <li>二级菜单</li>
            <li>二级菜单</li>
            <li>二级菜单</li>
            <li>二级菜单</li>
            <li>二级菜单</li>
        </ul></li>
    <li>一级菜单
        <ul class="second-list">
            <li>二级菜单</li>
            <li>二级菜单</li>
            <li>二级菜单</li>
            <li>二级菜单</li>
            <li>二级菜单</li>
        </ul></li>
</ul>
<div>我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字我是文字</div>
</body>
</html>
上一篇下一篇

猜你喜欢

热点阅读