Html 页脚没有粘在底部
无论我尝试什么(stackoverflow的教程/帖子,w/e),我都无法让我的页脚停留在网站的底部 我为Wordpress创建了这个自定义主题(我没有在Wordpress stackexchange上发布,因为这是一个CSS问题,而不是WP问题)。无论如何,这是我的网站: 我没有把任何内容放在我的页脚或任何CSS中,所以如果有人想尝试CSS代码,这是很容易做到的 页脚位于:Html 页脚没有粘在底部,html,css,wordpress,footer,Html,Css,Wordpress,Footer,无论我尝试什么(stackoverflow的教程/帖子,w/e),我都无法让我的页脚停留在网站的底部 我为Wordpress创建了这个自定义主题(我没有在Wordpress stackexchange上发布,因为这是一个CSS问题,而不是WP问题)。无论如何,这是我的网站: 我没有把任何内容放在我的页脚或任何CSS中,所以如果有人想尝试CSS代码,这是很容易做到的 页脚位于: html > body > div#page > footer.site-footer 提前谢谢
html > body > div#page > footer.site-footer
提前谢谢 也许可以在css样式中添加类似的内容
#page .site-footer {
background-color: #123456;
width: 100%;
position: fixed;
height: 100px;
bottom: 0;
}
我添加了一个背景色,使它现在可见
编辑:
如果您希望页脚仅显示在底部,而不与您一起滚动,请添加以下内容,而不是上面的内容:
#page .site-footer {
background-color: #123456;
width: 100%;
position: relative;
height: 100px;
margin-top: 100%;
}
编辑2
我发现了问题 你必须改变你的div内容风格 而不是
div#content{
position: absolute;
}
使用以下命令:
div#content{
position: relative;
}
并将#page.site footer的样式更改为:
#page .site-footer {
background-color: #123456;
width: 100%;
position: relative;
height: 100px;
bottom: 0;
}
问题是由位置引起的:绝对内容。可能会在css样式中添加类似的内容
#page .site-footer {
background-color: #123456;
width: 100%;
position: fixed;
height: 100px;
bottom: 0;
}
我添加了一个背景色,使它现在可见
编辑:
如果您希望页脚仅显示在底部,而不与您一起滚动,请添加以下内容,而不是上面的内容:
#page .site-footer {
background-color: #123456;
width: 100%;
position: relative;
height: 100px;
margin-top: 100%;
}
编辑2
我发现了问题 你必须改变你的div内容风格 而不是
div#content{
position: absolute;
}
使用以下命令:
div#content{
position: relative;
}
并将#page.site footer的样式更改为:
#page .site-footer {
background-color: #123456;
width: 100%;
position: relative;
height: 100px;
bottom: 0;
}
问题是由位置引起的:绝对内容。如何:
.site-footer {
position: fixed;
bottom: 0px;
}
要查看页脚,您当然需要内容。。。或者添加固定的宽度和高度以及背景色怎么样:
.site-footer {
position: fixed;
bottom: 0px;
}
要查看页脚,您当然需要内容。。。或者添加固定的宽度和高度以及背景色使用以下技巧:
或
css
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
#footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}
html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Sticky Footer Template for Bootstrap</title>
</head>
<body>
<!-- Begin page content -->
<div class="container">
<div class="page-header">
<h1>Sticky footer</h1>
</div>
</div>
<div id="footer">
<p class="text-muted">Place sticky footer content here.</p>
</div>
</body>
</html>
用于引导的粘性页脚模板
粘脚
将粘性页脚内容放在此处
使用以下技巧:
或
css
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
#footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}
html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Sticky Footer Template for Bootstrap</title>
</head>
<body>
<!-- Begin page content -->
<div class="container">
<div class="page-header">
<h1>Sticky footer</h1>
</div>
</div>
<div id="footer">
<p class="text-muted">Place sticky footer content here.</p>
</div>
</body>
</html>
用于引导的粘性页脚模板
粘脚
将粘性页脚内容放在此处
好的,在更详细地研究了您的问题(我正在工作)之后,我发现您需要删除/添加以下内容
删除div id=“第页”
删除div id=“content”
将以下css添加到div id=“primary”
将内容添加到页脚,您将看到它正在工作
编辑:css到标题标签
top: 0px;
好的,在更详细地研究了您的问题(我正在工作)之后,我发现您需要删除/添加以下内容 删除div id=“第页” 删除div id=“content” 将以下css添加到div id=“primary” 将内容添加到页脚,您将看到它正在工作 编辑:css到标题标签
top: 0px;
我自己也有过类似的问题。 我发现在.wpwrap中有一个额外的结束div标记 .wpfooter应该位于.wpwrap的内部,以便粘贴到其底部(使用pos:absolute&bottom0方法) 额外的结束标记导致.wpwrap和.wpfooter成为同级,因此.wpfooter被绝对定位到body 只需检查html结构即可查看.wpfooter的呈现位置
我希望这是有道理的,并希望能帮助到别人!:) 我自己也遇到过这个问题,或者至少有一个类似的问题。 我发现在.wpwrap中有一个额外的结束div标记 .wpfooter应该位于.wpwrap的内部,以便粘贴到其底部(使用pos:absolute&bottom0方法) 额外的结束标记导致.wpwrap和.wpfooter成为同级,因此.wpfooter被绝对定位到body 只需检查html结构即可查看.wpfooter的呈现位置
我希望这是有道理的,并希望能帮助到别人!:) 不知道为什么,但这对我来说很有效:
#page .site-footer {
width: 100%;
position: absolute;
height: 100px;
margin-top: 100%;
}
不知道为什么,但这对我有用:
#page .site-footer {
width: 100%;
position: absolute;
height: 100px;
margin-top: 100%;
}
如果你正在寻找一种快速的解决方法,使用这个 在css中添加
#页脚{top:100vh;position:relative;width:100%;}
在你的html中添加嘿,看,我被强制排在了底部
我希望这会有所帮助,但请记住,在设计页面时,唯一不应该静态设置的是高度
最好的方法是在div内容处设置一个最小高度,或者在容器处设置一个最小高度,甚至在body标记处设置一个最小高度!通常我会对body标签minheight:100vh
执行此操作,这将使页脚始终位于底部,而不必担心将来的页面
快乐编码如果您正在寻找快速解决方法,请使用此 在css中添加
#页脚{top:100vh;position:relative;width:100%;}
在你的html中添加嘿,看,我被强制排在了底部
我希望这会有所帮助,但请记住,在设计页面时,唯一不应该静态设置的是高度
最好的方法是在div内容处设置一个最小高度,或者在容器处设置一个最小高度,甚至在body标记处设置一个最小高度!通常我会对body标签minheight:100vh
执行此操作,这将使页脚始终位于底部,而不必担心将来的页面
快乐编码由于页脚中没有可供开始的内容,因此不清楚您到底想要什么。你说的“呆在底层”是什么意思。添加内容时页脚会发生什么情况?您可能忘记创建footer.php文件并连接到索引。php@AndrewMatthew正如我在我的原始帖子中所写:我没有在我的页脚或任何CSS中添加任何内容,所以如果有人想尝试CSS代码,