当内容区域不满一屏时,footer一直在屏幕最下面

2019-05-10  本文已影响0人  chaocc

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title></title>

    <style type="text/css">

        body{height: 100%;}

        html{height: 100%;}

        .m-container{position: relative;min-height: 100%;height: auto !important;height: 100%;background-color: red;width: 100%;}

        .header{width: 100%;height: 20px;background-color: #000;}

        .main{padding-bottom: 140px;width: 100%;}   

        .footer{position: absolute;bottom: 0;background-color: #ccc;width: 100%;height: 140px;}

    </style>

</head>

<body>

    <div class="m-container">

        <div class="header"></div>

        <div class="main"></div>

        <div class="footer"></div>

    </div>

</body>

</html>

上一篇 下一篇

猜你喜欢

热点阅读