粘滞的页脚与长文本

Kah*_*ahn 0 html css

我的页面中有很长的文字.我希望我的页脚粘在底部,文本应该隐藏在页脚下面,这样我就可以滚动文本了.页脚下不应有任何文字.我怎样才能做到这一点?

.container {}
  footer {
        position: absolute;
        bottom: 0;
       }
Run Code Online (Sandbox Code Playgroud)
<html>
<div class="container">
  <p>Long long text</p>
  <footer>My footer</footer>
</div>

</html>
Run Code Online (Sandbox Code Playgroud)

Zub*_*ber 5

你应该通过使用fixedposition来实现这一点absolute

.container {
  padding-bottom: 40px;
}
  footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: black;
  color: white;
  padding: 10px 0;
   text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
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.
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.
</div>

<footer>Footer Here</footer>
Run Code Online (Sandbox Code Playgroud)