如何停止空白空间的背景图像重复? [英] How to stop background image repeating for empty space?

查看:152
本文介绍了如何停止空白空间的背景图像重复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚遇到重复背景图片的问题。

Just ran into a problem with repeating background image.

在内容非常短,比监视器高度短的情况下,背景图像对于额外的空间仍然重复。

In the case when the content is very short, shorter than the monitor height, the background image is still repeating for the extra space.

请参阅屏幕截图。

橙色栏是我的页脚。

底部灰色区域是额外的空间。

Can I make stop the background image repeating for the bottom area?

p>我的意思是理想的背景图像只要重复我的内容。

I mean ideally the background image just repeats as long as my content.

任何帮助将不胜感激。

Any help will be appreciated.

推荐答案

而不是把背景贴在身上,拍下另一个div,把背景放在那里。内部内容会将div推到正确的高度,并会在该点停止(除非另有说明)。

Rather than sticking the background onto the body, slap another div in there and put the background onto that. The inner content will push the div to the right height and will stop at that point (unless otherwise stated).

例如:

<!doctype html>
<html>
<body>
    <div id="background">
        Your inner content
    </div>    
</body>
</html>

并将重复的背景放在 #background 在你的css而不是你的身体。

and put your repeating background onto #background in your css rather than your body.

这篇关于如何停止空白空间的背景图像重复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆