Html 在我的 tumblr 博客上,如何将背景变成一张巨大的图像?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8689208/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 12:15:08  来源:igfitidea点击:

On my tumblr blog, how do I get the background to be one giant image?

htmlbackgroundblogstumblr

提问by user1124485

This is my tumblr blog:

这是我的 tumblr 博客:

thestorywithnoending.tumblr.com

thestorywithnoending.tumblr.com

the code for the blog is a theme I got here:

博客的代码是我在这里得到的一个主题:

http://themes.pouretrebelle.com/lycoris/?download

http://themes.pouretrebelle.com/lycoris/?download

(just scroll down a bit, the whole code is there)

(只需向下滚动一点,整个代码就在那里)

I want the background image to just be ONE image...

我希望背景图片只是一张图片...

I know I'm not being descriptive enough, so to fruther explain: I want it to be like this:

我知道我的描述不够充分,所以要进一步解释:我希望它是这样的:

http://chloescheffe.com/

http://chloescheffe.com/

you see how on that website the background image is.... everything basically. And when you change the size of the webpage, the background image changes accordingly?

你在那个网站上看到背景图片是如何......基本上一切都如此。而当你改变网页的大小时,背景图片也会随之改变?

how can I do that on my tumblr blog?

我怎么能在我的 tumblr 博客上做到这一点?

THANKS :)

谢谢 :)

回答by Different55

with css. set the height and width of your bg image to 100%. sorry, i'd give you the code but this keyboard doesn't have all the characters of a larger one. use the background-size css property w3schools.com/cssref/css3_pr_background-size.asp

用CSS。将 bg 图像的高度和宽度设置为 100%。抱歉,我会给你代码,但是这个键盘没有更大键盘的所有字符。使用 background-size css 属性 w3schools.com/cssref/css3_pr_background-size.asp

回答by ThinkingStiff

You can do this two ways using background-size. One will stretch the image and one will fill the width properly, but cut off the bottom.

您可以通过两种方式使用background-size. 一个将拉伸图像,一个将正确填充宽度,但切掉底部。

For stretch, add this to your bodyCSS:

对于拉伸,将其添加到您的bodyCSS:

body {
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

For width-fill (this looks better with your current blog), add this to your bodyCSS:

对于宽度填充(这与您当前的博客看起来更好),将其添加到您的bodyCSS:

body {
    background-repeat: no-repeat;
    background-size: cover;
}