另一个粘性页脚问题。 100% 宽度的 div 与重复的 bg 和 div 向右浮动
我知道这个问题是一个老问题,但经过研究、尝试和尝试了两天,我仍然没有任何运气,我希望这里有人能给我一些建议!
问题:
我有一个页面需要应用粘性页脚,通常很简单,但这就是我遇到问题的地方。
我可以让页脚 div(#footer) 毫无问题地粘在底部(它的宽度为 100%,带有重复的背景图像)然后在这个 DIV 中我浮动另一个(#cut),右侧有一个背景图像(我的例子中的剪刀)。这也很好用。
问题是我需要在主 div 下方另一个 100% 宽度的 div(#footer-link-wrap),以便我可以在中心浮动一些导航链接(#links)。在 #footer-link-wrap 中,我需要另一个图像一直向右浮动,尝试使用定位背景执行此操作,但我无法让它工作。
我完全碰壁了,我非常感谢任何反馈,我刚刚在长时间休息后重新开始设计,这可能是我犯了一个愚蠢的错误。
css 如下:
* {
margin:0;padding:0;
}
html, body {
height: 100%;
background-color:#000;
}
#wrap {
min-height: 100%;
}
#main {
overflow:auto;
padding-bottom: 60px;
}
#footer {
position: relative;
margin-top:-20px;
height: 20px;
clear:both;
width:100%;
background:url(foot-hair.png) repeat-x;
background-position:0 8px;
}
#cut{
float:right;
width:40px;
height:20px;
background: url(haircut.png);
}
#footer-link-wrap{
margin-top:-40px;
height:40px;
width:100%;
background:url(hair-fall.png) no-repeat;
background-position:bottom right;
}
#links{
position:relative;
margin-left:auto;
margin-right:auto;
width:800px;
background-color:#fff;
}
/*for opera
body:before {
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;
}*/`
这是示例的链接 float help
I know this question is an old one but having researched and tried and tried for 2 days now i am still not having any luck and I hope someone here could give me some advice!
Problem:
I have a page that i need to apply a sticky footer, simple normally but here's where i'm having the problem.
I can get the footer div(#footer) to stick to the bottom with out a problem (it's 100% width with a repeating background image) Then within this DIV I float another(#cut) with a bg-image to the right( the scissors in my example). This also works fine.
The problem is that I need another 100% width div(#footer-link-wrap) below the primary one so that I can float some nav links(#links) in the centre. Within the #footer-link-wrap i need another image floated all the way to the right, tried doing this with a positioned background but i can't get it to work.
I've totally hit a wall and I would greatly appreciate any feedback, i've just getting back into design after a long break and it's probably me making a silly mistake.
css as follows:
* {
margin:0;padding:0;
}
html, body {
height: 100%;
background-color:#000;
}
#wrap {
min-height: 100%;
}
#main {
overflow:auto;
padding-bottom: 60px;
}
#footer {
position: relative;
margin-top:-20px;
height: 20px;
clear:both;
width:100%;
background:url(foot-hair.png) repeat-x;
background-position:0 8px;
}
#cut{
float:right;
width:40px;
height:20px;
background: url(haircut.png);
}
#footer-link-wrap{
margin-top:-40px;
height:40px;
width:100%;
background:url(hair-fall.png) no-repeat;
background-position:bottom right;
}
#links{
position:relative;
margin-left:auto;
margin-right:auto;
width:800px;
background-color:#fff;
}
/*for opera
body:before {
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;
}*/`
Here's a link to the example float help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过此实现:http://www.cssstickyfooter.com/
更新:
这是我发现的问题:
粘性页脚的配置
根据规格。这
#main 的 padding-bottom 不是
与页脚的高度相同;
祝你好运。
Have tou tried this implementation: http://www.cssstickyfooter.com/
Update:
here are the problems I found:
configuration for the sticky footer
according to the specification. The
padding-bottom of #main was not the
same as the height of the footer;
good luck.