zoukankan      html  css  js  c++  java
  • div 自适应高度 自动填充剩余高度

    https://www.cnblogs.com/pangguoming/p/5695184.html

    知道A的高度, 给B剩余 方案1:

    Html:

    <div class="outer">
        <div class="A"> 头部DIV </div>
        <div class="B">下部DIV </div>
    </div>
    
    CSS:
    html,body { 
       height: 100%; padding: 0; margin: 0; 
    }
    
    .outer { height: 100%; padding: 100px 0 0; box-sizing: border-box ; position: relative; }
    
    .A { height: 100px; background: #BBE8F2; position: absolute; top: 0 ; left: 0 ;  100%; }
    
    .B { height: 100%; background: #D9C666; }
    View Code

     效果:

    方案2:需要box-sizing

    HTML:

    <div class="outer">
        <div class="A">头部DIV</div>
        <div class="B">下部DIV</div>
    </div>
    
    html,
    body { height: 100%; padding: 0; margin: 0; }
    .outer { height: 100%; padding: 100px 0 0; box-sizing: border-box ; }
    .A { height: 100px; margin: -100px 0 0; background: #BBE8F2; }
    .B { height: 100%; background: #D9C666; }

    效果:

  • 相关阅读:
    偏函数
    装饰器
    排序
    匿名函数
    参数传递
    pass语句
    不定长函数
    通用函数
    不定长参数(元祖)
    不定长参数(字典)
  • 原文地址:https://www.cnblogs.com/grj001/p/12222985.html
Copyright © 2011-2022 走看看