html - 调整页面大小时需要页脚保持在内容下方

标签 html css footer

我提前道歉,因为这可能是一个重新发布,但是我已经在许多线程中尝试了解决方案,但没有找到解决我的问题的方法。

您可以在以下链接中查看我的文件。

https://www.dropbox.com/sh/ovom8y01p16iqri/AADtBbLW5aYmANsy7R_3x_Vga

问题是,当我重新调整网页大小时,网页变长了,但我的页脚仍保留在原位。 我还添加了两个媒体查询,我也需要将页脚留在底部。

如果你们能提供任何帮助,我将不胜感激。

谢谢 阿米特

编辑:

谢谢,我真的很感激所有的帮助。尽管我无法继续前进。

每当我尝试将解决方案应用到我的页面时,页脚要么转到页面顶部,要么卡在中间。

我想我可能做错了什么。我所有的文件都在这个保管箱里。

https://www.dropbox.com/sh/ovom8y01p16iqri/AADtBbLW5aYmANsy7R_3x_Vga

再次感谢

阿米特

最佳答案

您可以尝试将此作为引用。

DEMO

HTML

<html lang="en">
  <body>
    <div class="pageOuter">
      <div class="header"> Lorem ipsum </div>  
      <div class="midContent">
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. <br/><a href="#" class="addMore" >Add more content</a><br/><a href="#" class="delete" >Delete Content</a></p>
      </div>  
      <div class="footer"> Lorem ipsum </div>
    </div>
  </body>
</html>

CSS

body {
  margin: 0;
}
body, html {
  height: 100%;
  min-height: 100%;
}
.pageOuter {
  position: relative;
  min-height: 100%;
}
.footer,
.header {
  padding: 10px;
  background:  #ccc ;
}
.midContent {
  padding: 10px 10px 70px 10px;
}
.footer {
  position:  absolute;
  left: 0;
  right: 0;
  bottom: 0;
}

关于html - 调整页面大小时需要页脚保持在内容下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24144209/

相关文章:

javascript - 为什么向下滚动到底部页面时会重复数据?

html - 为什么我的链接在 Firefox 中不起作用

iphone - 最初可见的单元格在调用 reloadSections :withRowAnimation: method 后变得不可见

html - 如何在CSS中创建一个球体?

javascript - 将 JSON 嵌套到不同的 HTML 表

html - 在 bootstrap carousel 中的每个图像的底部添加链接

css - 如何处理 CSS 中水平不均匀的导航?

jquery - 随着 jQuery DOM 操作(添加/删除/等)的内容更改,页面页脚在 View 中上下跳动

html - 页脚代码在CSS样式表中显示为红色,但是HTML代码很好

javascript - 查询 :contains() does not select the text if it is surrounded by tags