>  Q&A  >  본문

宽度自适应的问题?

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

小天小天2742일 전1518

모든 응답(2)나는 대답할 것이다

  • 数据分析师

    数据分析师2017-10-01 01:05:25

    너비 적응에 문제가 있나요? -PHP 중국어 홈페이지 Q&A - 폭 적응 문제? -PHP 중국어 홈페이지 Q&A

    꼭 보고 배워보세요.

    회신하다
    0
  • 迷茫

    迷茫2017-03-21 09:28:51

    <!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>

    회신하다
    0
  • 취소회신하다