导航栏

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style type="text/css">
    *{
        margin: 0;
        padding: 0;
        list-style: none;
    }
    .a{
        height: 60px;
        width: 100%;
        position: fixed;
    }
    .main{
       height: 1000px;
    }
    .nav{
        /* z-index: 10; */
        height: 60px;
        width: 100%;
        background-color: brown;/* 定位元素的z-index不是auto的时候就会创建层叠上下文 */
        position: relative;/*  */
        
    }
    .title{
        width: 100px;
        position: absolute;/*  */
        transform: translate(0,-50%);
        top: 50%;
        color: white;
        line-height: 60px;
        font-size: 25px;
        font-weight: 600;
    }
    .text1,.text2{
        position: relative;
        width: 100px;
        height: 60px;
        display: inline-block;
        left: 100px;
        text-align: center;
        line-height: 60px;
        color: white;
        z-index: 10;
    }
    .box1,.box2{
        top: -180px;/* -120容易导致box一出来就碰到鼠标激活box:hover (无动画效果直接闪现到底部)*/
        z-index: -10;
        position: absolute;
        line-height: 60px;
        width: 100px;
        text-align: center;
       /*  background-color: brown; */
        border-radius: 5px;
    }
    .box1{
        
        left: 100px;
    }
    .box2{
        left: 200px;
    }
    .text1:hover~ .box1{
        top: 60px;
        transition: .3s ;
    }
    .text2:hover~ .box2{
        top: 60px;
        transition: .3s;
    }
    .box1:hover{
        top: 60px;
    }
    .box2:hover{
        top: 60px;
    }
    .top1,.top2{
        border-top: solid;
        border-color: #d3e2e8;
    }

  .content1:hover,.content2:hover{
      background-color: brown;
      border-radius: 10px;
      cursor: pointer;
  }
    </style>
</head>
<body>
    <div class="a">
    <div class="nav">
        <div class="title">DESIGN</div>
        <div class="text1">text1</div>
        <div class="text2">text2</div>
        <div class="box1">
                <ul class="list1">
                    <li class="content1">text11</li>
                    <li class="content1 top1">text12</li>
                    <li class="content1 top2">text13</li>
                </ul>
        </div>
        <div class="box2">
                <ul class="list2">
                    <li class="content2">text21</li>
                    <li class="content2 top1">text22</li>
                    <li class="content2 top2">text23</li>
                </ul>
        </div>
    </div>
</div>
<div class="main">

</div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值