一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

div自适应高度自动填充剩余高度代码实例

时间:2020-07-11 编辑:袖梨 来源:一聚教程网

本篇文章小编给大家分享一下div自适应高度自动填充剩余高度代码实例,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。

方案1:

Html:

头部DIV
下部DIV

CSS:

css;">html,
body { height: 100%; padding: 0; margin: 0; }
.outer { height: 100%; padding: 100px 0 0; box-sizing: border-box ; position: relative; }
.A {  background: #BBE8F2; position: absolute; top: 0 ; left: 0 ; width: 100%; }
.B { height: 100%; background: #D9C666; }

效果:

方案2:

HTML:

头部DIV
下部DIV

CSS:

html,
body { height: 100%; padding: 0; margin: 0; }
.outer { height: 100%; padding: 100px 0 0; box-sizing: border-box ; }
.A {  margin: -100px 0 0; background: #BBE8F2; }
.B { height: 100%; background: #D9C666; }

效果:

热门栏目