html底部自适应,内容高度无法做到全屏

2018-03-20 / 4 阅读 / Html

用于底部自适应,保持页脚在内容不够的情况下保持在底部,当内容足够或高于屏幕,会自动将页面撑开,底部依旧保持在底部。


<html>
<head>
<style>
    *{
        margin: 0px;
        padding: 0px;
    }
    html,body{
        height: 100%;
    }
    .wb-frame{
        position: relative;
        width: 100%;
        height: auto;
        min-height: 100%;
    }
    .wb-main{
        background-color: #333333;
        padding-bottom: 50px;
    }
    .wb-foot{
        position: absolute;
        bottom: 0px;
        left: 0px;
        height: 50px;
        width: 100%;
        background-color: #06865e;
    }
</style>
<!--[if IE 6]->
    <style>
        #wapper{height:100%;} /* IE在高度不够时会自动撑开层*/
    </style>
    <![endif]-->
</head>
<div class="wb-frame">
    <div class="wb-main"></div>
    <div class="wb-foot"></div>
</div>
<body>
</body>
</html>
相关推荐