html - 身体背景图像正在重复
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3567122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
html - body backgorund image is repeating
提问by Ronny
As you can see in this page - http://www.white-cell.com/events.htm- at the bottom, the background image is repeating because of the long text. the line that related to this is:
正如您在此页面中看到的 - http://www.white-cell.com/events.htm- 在底部,由于文本较长,背景图像正在重复。与此相关的行是:
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" background="images/bg_wide.gif">
thank you!
谢谢你!
回答by Pekka
Use CSS to both specify your background image (background
is very deprecated) and to turn off the repeating.
使用 CSS 来指定您的背景图像(background
非常不推荐使用)并关闭重复。
Put this in your head
section:
把它放在你的head
部分:
<style type="text/css">
body
{
background-image: url(images/bg_wide.gif);
background-repeat: no-repeat;
}
</style>
There is also a property to position the background image (background-position
).
还有一个属性来定位背景图像 ( background-position
)。
回答by Sarfraz
You can use this style and keep image from repeating:
您可以使用此样式并防止图像重复:
body {
background:url(images/bg_wide.gif) no-repeat;
}
The no-repeat
will keep image from repeating.
在no-repeat
将保持图像的重复。