帮我看看我这个三级栏为什么不出现?

来源:4-2 侧边栏导航跟随案例

慕九州7049358

2019-02-20 23:02


<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

<style>

    *{

     margin: 0;

     padding: 0;

    }

    .page{

     width: 100%;

     height: 4043px;

     background: url("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1550675751768&di=9c864fe99df038b9d377d382ab1dddd6&imgtype=0&src=http%3A%2F%2Fgss0.baidu.com%2F7Po3dSag_xI4khGko9WTAnF6hhy%2Fzhidao%2Fwh%3D450%2C600%2Fsign%3De01bcbb01430e924cff1943579384230%2F7c1ed21b0ef41bd54a7d3e4c5ada81cb39db3d58.jpg") center top no-repeat;

    }

    .nav{

     width: 160px;

     height: 205px;

     position: fixed;

     left: 0;

     top: 50%;

     margin-top: -103px;

     font-family: 'Miscrosoft YaHei';


    }

    .tit{

     width: 160px;

     height: 40px;

    }

    .nav-li{

     width: 160px;

     height: auto;

     border-bottom: 1px solid #FFF;

     background: #333;

     text-align: center;

     line-height: 40px;

     color: #FFF;

     font-size: 16px;

     cursor: pointer;

    }

    .nav-li:hover ul{  /*隐藏二级*/

     display: block; 

    }

    .nav-li ul{

     width: 160px;

     height: auto;

     background: #FFF;

     display: none;  /*隐藏二级*/

    }

    .nav-li ul li{

     width: 160px;

     height: 40px;

     border-bottom: 1px dashed #666; 

     color: #333;

     text-align: center;

     line-height: 40px;  /*行高*/

     position: relative;

    }

    .nav-li ul li:haver .list-3{

            display: block;

    }

    .list-3{

     width: 160px;

     height: auto;

     position: absolute; /*定位属性,三级在旁边展开*/

     left: 160px;

     top: 0px;

     display: none;

    }

    .list-3Dom{

     width: 160px;

     height: 40px;

     background: #444;

     border-bottom: 1px solid #FFF;

     text-align: center;

            line-height: 40px;

            color: #FFF;

    }

</style>

</head>

<body>

<div class="page">

<div class="nav">

<div class="nav-li">

<div class="tit">标题</div>

<ul>

<li>

二级栏目

<div class="list-3">

<div class="list-3Dom">三级</div>

<div class="list-3Dom">三级</div>

<div class="list-3Dom">三级</div>

</div>

</li>

<li>

二级栏目

</li>

<li>

二级栏目

</li>

</ul>

</div>

<div class="nav-li">标题标题</div>

        <div class="nav-li">标题标题</div>

        <div class="nav-li">标题标题</div>

</div>

</div>

</body>

</html>


写回答 关注

1回答

  • qq_慕数据0005987
    2019-02-25 09:30:40

     .nav-li ul li:haver .list-3{display:block    }你把hover写成了haver改一下就好了


css定位 position

老师带你了解CSS中定位的知识,并运用到实际案例中。

49036 学习 · 95 问题

查看课程

相似问题