三级标题定位在左边固定位置

盒子模型:通过改变元素的外边距或者内边距来实现元素的移动。

定位:是通过元素的位置移动出现在网页的相对位置中。

<style>
        *{
            padding: 0;
            margin: 0;
        }
        .page{
            width: 100%;
            height: 4043px;
            /*background: url("") center top no-repeat;*/
        }
        .nav{
            width: 160px;
            height: 205px;
            position: fixed;
            left: 0;
            top: 50%;
            margin-top:-103px ;
            font-family: 'Miscrosoft YaHei';
        }
        .nav-li{
            width: 160px;
            height: auto;
            border-bottom: 1px solid #ffffff;
            background: #333;
            text-align: center;
            line-height: 40px;
            color: #ffffff;
            font-size: 16px;
            cursor: pointer;/*指针的形状变成手的形状。表示可点击*/
        }
        .tit{
            width: 160px;
            height: 40px;
        }
        .nav-li ul{
            width: 160px;
            height: auto;
            background: #ffffff;
            display: none;
        }
        .nav-li ul li{
            width: 160px;
            height: 40px;
            border-bottom: 1px dashed #666666;
            color: #333333;
            text-align: center;
            line-height: 40px;
        }
        .nav-li ul li:hover .list-3{
            display: block;
        }
        .nav-li:hover ul{
            display: block;
        }
        .list-3{
            width: 160px;
            height: auto;
            position: absolute;
            left: 160px;
            top: 40px;
            display: none;
        }
        .list-3Dom{
            width: 160px;
            height: 40px;
            background: #444;
            border-bottom: 1px solid #ffffff;
            text-align: center;
            line-height: 40px;
            color: #ffffff;

        }
    </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 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 class="nav-li">慕课网的标题</div>
        <div class="nav-li">慕课网的标题</div>
    </div>
</div>

</body>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值