Web前端---绝对定位菜单

1.目标图:

2.实现代码:

<style>
 
    #box1{
 
        width: 240px;
 
        margin: auto;
 
        margin-top: 100px;
 
        display: flex;
 
        flex-direction: row;
 
    }
	.son1{
			 
	    border: 1px solid lightgrey;
			 
	    background-color: lightpink;
			 
	    text-align: center;
			 
	    width: 80px;
			 
	    height: 35px;
			 
	    line-height: 35px;
			 
	    overflow: hidden;
			 
	}
	.son2{
			 
	    border: 1px solid lightgrey;
			 
	    background-color: rgb(247, 159, 127);
			 
	    text-align: center;
			 
	    width: 180px;
			 
	    height: 60px;
			 
	    line-height: 35px;
			 
	    position: relative;
			 
	    top: -36px;
			 
	    left: 80px;
 
    }
 
    #b1:hover{
 
        overflow: visible;
 
        background-color: mediumturquoise;
 
        color: white;
 
        z-index: 999;
 
        cursor: pointer;
 
    }
 
    .son1:hover,.son2:hover{
 
        background-color: mediumturquoise;
 
        cursor: pointer;
 
    }
 
    #b1-1:hover{
 
        overflow: visible;
 
        background-color: mediumturquoise;
 
        z-index: 999;
 
        cursor: pointer;
 
    }
 
</style>
 
<body>
 
    <div id="box1">
                <div id="b1-1" class="son1">
 
                    手机
 
                    <div>
 
                        <div id="b1-1-1" class="son2"><img src="https://img0.baidu.com/it/u=2751713341,4226842008&fm=253&fmt=auto&app=138&f=JPEG?w=803&h=500" alt="" width="60px;" height="57px"/>Mate系列</div>
                        <div id="b1-1-1" class="son2"><img src="https://download-c-retail.huawei.com/content/dam/huawei-cbg-site/cn/mkt/pdp/phones/p60/images/design/huawei-p60-id.png" alt="" width="60px" height="57px"/>P系列</div>
						<div id="b1-1-1" class="son2"><img src="https://p3.toutiaoimg.com/tos-cn-i-qvj2lq49k0/649d95da409542ffa7eddba8f456a828~tplv-tt-large.image" alt="" width="60px" height="57px"/>Pocket系列</div>
						<div id="b1-1-1" class="son2"><img src="https://img2.baidu.com/it/u=616438917,1999920684&fm=253&fmt=auto&app=138&f=JPEG?w=813&h=500" alt="" width="60px" height="57px"/>nova系列</div>
						<div id="b1-1-1" class="son2"><img src="https://img2.baidu.com/it/u=3803097368,2975783155&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500" alt="" width="60px" height="57px"/>华为畅享系列</div>
                    </div>
</body>

3.成果展示:

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值