背景内容图像需要粘在底部
我正在尝试推送我的背景内容图像并使其粘在页面底部。该图像不是页脚,因为图像将位于某些内容的后面。但是,当内容很少时,图像不应在顶部被切断,而当内容较多时,图像应粘在底部!
还没有什么工作。有人能给我一些建议吗?
这里有两个例子。一个包含适合窗口的内容,另一个包含更多内容。
这里有两个链接;
http://www.andrewa.org/testing/mosaik-test /content-imagebottom-test.html
http:// /www.andrewa.org/testing/mosaik-test/content-imagebottom-test2.html
提前谢谢你们!
I'm trying to push my background content image and make it stick to bottom of my page. The image is NOT a footer since the image will be behind some of the content. But the image shouldn't get cut off at the top when there is little content and and should stick to the bottom when there is loads of content!
Nothing working quite yet. Anyone got any tips for me?
Here are two examples. One with content fitting the window and the other with a lot more content.
Here are two links;
http://www.andrewa.org/testing/mosaik-test/content-imagebottom-test.html
http://www.andrewa.org/testing/mosaik-test/content-imagebottom-test2.html
Thank you in advance folks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我将使用
background-attachment:fixed;
将图像作为body
的背景并添加:所以总数将是:
I would put the image as a background to the
body
usingbackground-attachment: fixed;
and add:So the total would be:
将背景应用到包装纸上,并将背景位置设置为底部,就像您所做的那样。诀窍是在包装器上设置与背景图像高度相同的最小高度。这将解决内容不足的问题,同时在内容很多时仍然随页面增长。
Apply the background to your wrapper and set the background-position to bottom as you have done. The trick is to set a minimum height on your wrapper that is the same height as your background-image. This will solve the issue of not enough content while still growing with the page when there is lots of content.
我相信你的问题有两个方面。首先,您为 #content-image div 设定了高度。去掉那个高度。
其次,因为该 div 中的内容是浮动的,所以您需要清除 #content-image div 上的浮动。类似:“溢出:隐藏;清除:两者”
尝试一下。
I believe your problem is two fold. First, you have a set height for your #content-image div. Remove that height.
Secondly because your content within that div is floated, you need to clear the float on the #content-image div. something like: "overflow:hidden; clear:both"
Try that.
粘性页脚和粘性背景合二为一。将背景图像的高度作为页脚高度,并确定内容需要重叠多少图片。要让粘性页脚“消失”,请在主边距底部使用与页脚高度相同的数字。这是来自粘性页脚原始设计的适度设计:http://www. webcreationz.nl/de-ultieme-sticky-footer-code(抱歉,该网站是荷兰语)。
我刚刚想通了这一点。我希望它能帮助某人。
HTML:
CSS:
A sticky footer and a sticky background in one. Take the height of your background image as your footer height and determine how much of the picture needs to be overlapped by your content. To let the sticky footer "disappear" use the same number in the main margin-bottom as you have for the footer height. This is a moderated design from original design of sticky footer from: http://www.webcreationz.nl/de-ultieme-sticky-footer-code (sorry site is in Dutch).
I just figured this out. I hope it will help someone.
HTML:
CSS: