前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >z-index使用无效的解决办法

z-index使用无效的解决办法

作者头像
不爱吃糖的程序媛
发布2024-01-18 21:08:07
730
发布2024-01-18 21:08:07
举报

重点:z-index要配合position一起用,否则无效;

效果图:

在这里插入图片描述
在这里插入图片描述

源代码:

代码语言:javascript
复制
<div class="warehouse-item-header">
    <div class="background-icon">
       <Icon
         class="icon-notice-copy"
         link="icon-cangkukapianbeijing-copy"
         customStyle="width:86px;height:86px;"
       ></Icon>
     </div>
</div>     

.warehouse-item-header {
   height: 54px;
     line-height: 54px;
     font-size: 14px;
     font-weight: 400;
     padding: 0 16px;
     position: relative;

     .background-icon {
       position: absolute;
       top: 0;
       left: 0;
       width: 72px;
       height: 72px;
       z-index: 1;
       overflow: hidden;
       .svg-div {
         margin-left: -14px;
         margin-top: -14px;
       }
     }
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2024-01-18,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档