zoukankan      html  css  js  c++  java
  • html布局【内容小与一页时footer在页面底部,内容大与一页时footer在内容下面】

    1. <html></html>的高度是窗口大小<body></body>的高度是里面内容的高度

    2. 想实现这个,就要给body min-height:100%所以刚开始内容少时body的高度也可以撑满窗口大小,内容翻页时高度已经大与  100%了,就无所谓了

      为了把body做为父元素把内容都放到这里面而不是浏览器窗口,所以body设置position:relative

    <html>
    <head>
    <title>内容小与一页时footer在页面底部,内容大与一页时footer在内容下面</title>
    </head>
    <body style="min-height: 100%;position: relative;">
    <div style="background-color:grey;text-align:center;">
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    content</br>
    </div>
    <div style="position:absolute;height:50px;background-color:blue;bottom: 0;left:0;right:0;">
    </div>
    </body>
    </html>
  • 相关阅读:
    github pages 正确访问方式
    jetty 热部署
    mysql 距离函数
    通过微信公众号ID生成公众号的二维码
    SQL Server 数据库备份失败解决方法
    js 替换部分内容为星号
    mysql 允许远程登录
    nginx 跨域配置
    两台阿里云服务器之间数据迁移
    新装修入住常识有什么
  • 原文地址:https://www.cnblogs.com/lindsayzhao103011/p/3383737.html
Copyright © 2011-2022 走看看