Satrol_ 2022-11-20 15:44 采纳率: 90.9%
浏览 0
已结题

固定定位设置宽高却遮挡底部模块问题

img


html部分


 <div class="search_module">
        <div class="search_module_hd">
            <a href="" class="sort"></a>
            <div class="search_con"></div>
            <a href="" class="register"></a>
        </div>
        <div class="search_module_bd">
            <form action="">
                <span></span>
                <input type="search">
            </form>
        </div>
    </div>
    <div class="banner">
        <span>123</span>
        <span>123</span>
        <span>123</span>
        <span>123</span>
        <span>123</span>
        <span>123</span>
        <span>123</span>
        <span>123</span>
        <span>123</span>
        <span>123</span>
    </div>

less部分

@base_font : 50;
.search_module {
    width: 15rem;
    height: (180rem/@base_font);
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f9dc63;
    .search_module_hd {
        height: (88rem/@base_font);
        display: flex;
        .sort {
            width: (36rem/@base_font);
            height: (60rem/@base_font);
            margin: (20rem/@base_font) (25rem/@base_font) 0;
            background: url(/images/sort.png) no-repeat;
            background-size: (36rem/@base_font) (60rem/@base_font);
        }
        .register {
            width: (36rem/@base_font);
            height: (60rem/@base_font);
            margin: (20rem/@base_font) (25rem/@base_font) 0;
            background: url(/images/user.png) no-repeat;
            background-size: (36rem/@base_font) (60rem/@base_font);
        }
        
        .search_con {
            flex: 1;
            background: url(/images/animate.gif) no-repeat center center;
            background-size: (390rem/@base_font) (76rem/@base_font);
        }
        
    }
    .search_module_bd {
        height: (92rem/@base_font);
        position: relative;
        span {
            position: absolute;
            top: 12px;
            left: 30px;
            color: #cccccc;
            &::after {
                content: '';
                font-family: 'icomoon';
                display: inline-block;
                width: (16rem/@base_font);
                height: (16rem/@base_font);
            }
        }
        
        input {
            margin: (5rem/@base_font) (20rem/@base_font);
            width: (702rem/@base_font);
            height: (66rem/@base_font);
            border-radius: (30rem/@base_font);
            box-sizing: border-box;
            padding-left: (40rem/@base_font);
            font-size: (20rem/@base_font);
            border: 0;
            outline: none;

        }
    }
}
.banner {
    width: 15rem;
    height: (284rem/@base_font);
    background-color: white;
    display: flex;
    flex-wrap: wrap;
    span {
        width: 3rem;
        height: (142rem/@base_font);
    }
}

  • 写回答

2条回答 默认 最新

  • Satrol_ 2022-11-21 08:39
    关注

    padding-top解决margin会导致固定定位坍塌
    https://blog.csdn.net/WiseGirls/article/details/108581508

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 11月29日
  • 已采纳回答 11月21日
  • 创建了问题 11月20日

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法