宽度自适应的问题?
小天
小天 2017-03-21 09:27:55
0
2
1517

单页面应用里,想让footer固定在底部,用的postion,然而如果文章内容超出一屏,footer就会定位在一屏的地方。如果不写html 100%的宽度,其他不足一屏的页面定位就不在页面底部了,有什么解决的方案吗?

小天
小天

勇敢站起来快步向前冲是你唯一的出路

全部回复(2)
数据分析师

宽度自适应的问题?-PHP中文网问答-宽度自适应的问题?-PHP中文网问答

围观一下哦,学习一下。

迷茫
<!DOCTYPE html>
<html>
<head>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        html, body {
            height: 100%;
        }
        div {
            position: relative;
            min-height: 100%;
        }
        footer {
            position: absolute;
            bottom: 0px;
            background: grey;
            width: 100%;
            height: 50px;
        }
        p {
            height: 2000px;
        }
    </style>
</head>
<body>
<div>
    <p></p>
    <footer>123</footer>
</div>
</body>
</html>
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!