css实现页面内容区撑满全屏(内容全屏自适应)

实现效果

在这里插入图片描述

我刚开始想到的思路是 左边内容使用浮动 右边自适应

<div class="center_container clearfix">
            <div class="left_list">
                <p class="active_pp">数据统计</p>
                <p>标准规范</p>         
            </div>
            <div class="right_list">
              右边内容
            </div>
  </div>
.center_container{
    width: 1200px;
    margin:0 auto;
    height: 100%;
}
.left_list{
    float:left;
    height: 100%;
    min-height: calc(100vh - 330px);
    min-height: -moz-calc(100vh - 330px);
    min-height: -webkit-calc(100vh - 330px);
    width: 240px;
    background-color:#ffffff;
    padding-top: 32px;
    box-sizing: border-box;
}
.left_list p{
    height: 58px;
    line-height: 58px;
    font-size: 16px;
    color: #333333;
    text-align: center;
}

.right_list{
    background-color:#ffffff;
    height: 100%;
    min-height: calc(100vh - 330px);
    margin-left: 256px;
    padding: 30px 40px;
    box-sizing: border-box;
}

这样写完 实现了默认内容区域铺满全屏了 但是!!!!!当右边的内容超出默认高度之后 高度变高了 左边浮动栏 不会自适应变高~ 很难受
在这里插入图片描述
然后 我使用了第二个办法 成功解决 那就是使用 position定位

 <div class="center_container">
            <div class="left_list">
                <p class="active_pp">数据统计</p>
                <p>标准111</p>
   
            </div>
            <div class="right_list">
            右边内容区
            </div>
  </div>
.center_container{
    width: 1200px;
    margin:0 auto;
    position: relative;
    height: 100%;
}
.left_list{
    position: absolute;
    height: 100%;
    min-height: calc(100vh - 330px);
    min-height: -moz-calc(100vh - 330px);
    min-height: -webkit-calc(100vh - 330px);
    width: 240px;
    background-color:#ffffff;
    padding-top: 32px;
    box-sizing: border-box;
}
.left_list p{
    height: 58px;
    line-height: 58px;
    font-size: 16px;
    color: #333333;
    text-align: center;
}

.right_list{
    background-color:#ffffff;
    height: 100%;
    min-height: calc(100vh - 330px);
    margin-left: 256px;
    padding: 30px 40px;
    box-sizing: border-box;
}

至此完美解决~

完结撒花~~

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值