Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 粘性页脚不会保持向下_Html_Css - Fatal编程技术网

Html 粘性页脚不会保持向下

Html 粘性页脚不会保持向下,html,css,Html,Css,在我的页面上滚动时,我的页脚不会保持向下。有什么建议吗 页脚的CSS: .footer { position: fixed; left: 0; bottom: 0; width: 100%; text-align: center; color: #f2f2f2; margin: 0; height: 150px; background-color: #399D60; } 有什么办法解决这个问题吗?试试位置:sticky或位置:aboslute尝试位置:粘性或

在我的页面上滚动时,我的页脚不会保持向下。有什么建议吗

页脚的CSS:

.footer {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  text-align: center;
  color: #f2f2f2;
  margin: 0;
  height: 150px;
  background-color: #399D60;
}

有什么办法解决这个问题吗?

试试
位置:sticky
位置:aboslute

尝试
位置:粘性
位置:aboslute

如果html结构如下所示:

<footer>
    <!-- Your footer content go here -->
</footer>
或者你可以给它一个类
footer
,这样你就可以用
.footer

<footer class="footer">
    <!-- Your footer content go here -->
</footer>


现在,如果html结构如下所示,则可以使用类选择器(如
.footer

)将其作为目标:

<footer>
    <!-- Your footer content go here -->
</footer>
<footer class="footer">
    <!-- Your footer content go here -->
</footer>
或者你可以给它一个类
footer
,这样你就可以用
.footer

<footer class="footer">
    <!-- Your footer content go here -->
</footer>


现在,您可以使用类选择器(如
.footer

)来定位它。实际上,我写了一篇文章,介绍了如何制作适用于所有屏幕大小的简单响应粘性页脚。无需定位。您可以阅读它是如何工作的,也可以复制代码使其为您工作

<footer class="footer">
    <!-- Your footer content go here -->
</footer>

实际上,我写了一篇文章,介绍了如何制作适用于所有屏幕大小的简单响应的粘性页脚。无需定位。您可以阅读它是如何工作的,也可以复制代码使其为您工作


您的页脚不会向下移动,因为您设置了:
位置:固定


试试这个:
位置:相对

您的页脚不会向下移动,因为您设置了:
位置:固定


试试这个:
位置:相对

我们能看到你的
html
吗?我们能看到你的
html
吗?