被粘性页脚难住了 - 不会在预期的地方停止
我正在使用这个“版本”的粘性页脚: http://ryanfait.com/sticky-footer/
这是我试图让它发挥作用的地方: http://www.ewsprojects.com/~lyons
我希望它停在左栏的末尾,但无论出于何种原因,我无法让它在任何事情之前停止除了标题之外。有没有办法让它按照第一个链接中演示的方式在左栏之后停止?
这是 CSS:
* {
margin: 0;
}
#container{
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -40px;
}
#footer, .push{
height:40px;
width: 100%;
background: -moz-linear-gradient(top, #565656, #303030);
background: -webkit-gradient(linear, left top, left bottom, from(#565656), to(#303030));
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#565656', endColorstr='#303030');
}
如果您需要我提供任何其他信息,请告诉我。
I'm using this 'version' of sticky footer: http://ryanfait.com/sticky-footer/
Here's where I'm trying to get this to work: http://www.ewsprojects.com/~lyons
I want it to stop at the end of the left column, but for whatever reason, I can't get it to stop before anything other than the header. Is there any way to make it stop after the left bar in the manner that is demonstrated in the first link?
Here's the CSS:
* {
margin: 0;
}
#container{
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -40px;
}
#footer, .push{
height:40px;
width: 100%;
background: -moz-linear-gradient(top, #565656, #303030);
background: -webkit-gradient(linear, left top, left bottom, from(#565656), to(#303030));
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#565656', endColorstr='#303030');
}
If you need me to provide any additional info, please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您希望它不高于左栏,但如果页面变高,希望它粘在页面底部?
如果是这种情况,那么允许页脚高于左列的原因是因为左列是绝对定位的。因此,您的容器 div 没有任何东西强制它达到某个最小高度,因此当浏览器窗口较小时,它会变得比左列短。
试试这个:
overflow: hide;
添加到您的#container
divmargin: 0 0 50px;
添加到您的#left_bar
code> div#container
有margin: 0 0 -40px;
(抱歉我之前告诉过你要删除它)position
,#left_bar
div 中的left
和top
规则#account_linksposition
规则code> div说实话,我不确定为什么你需要绝对定位这个布局的很多部分。
编辑:
我编辑了上面的列表,因为我遗漏了一些东西。
I'm assuming you want it to go no higher than the left column, but want it to stick to the bottom of the page if the page becomes taller?
If that is the case then the reason the footer is allowed to go higher than the left column is because the left column is absolutely positioned. Because of this your container div has nothing forcing it to be a certain minimum height and so it becomes shorter than the left column when they browser window is smaller.
Try this:
overflow: hidden;
to your#container
divmargin: 0 0 50px;
to your#left_bar
div#container
hasmargin: 0 0 -40px;
(Sorry I told you to remove that before)position
,left
andtop
rules from your#left_bar
divposition
rule from your#account_links
divTo be honest I'm not sure why you needed to absolute position a lot of this layout.
Edit:
I edited the list above because I missed some things.