Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将背景图像添加到整个屏幕,跨越所有div_Php_Html_Css_Wordpress_Background Image - Fatal编程技术网

Php 将背景图像添加到整个屏幕,跨越所有div

Php 将背景图像添加到整个屏幕,跨越所有div,php,html,css,wordpress,background-image,Php,Html,Css,Wordpress,Background Image,我正在尝试使以下基于wordpress的站点具有单个连续的背景图像: 我可以改变单个元素的背景,但还并没有找到一种方法,可以让单个背景像这样延伸到整个屏幕 谢谢你的帮助 将此CSS添加到您的body类中 body.custom-background { background: url('/wp/wp-content/themes/twentyfourteen/assets/BG.jpg'); background-size: auto 100%; background-size: cover;

我正在尝试使以下基于wordpress的站点具有单个连续的背景图像:

我可以改变单个元素的背景,但还并没有找到一种方法,可以让单个背景像这样延伸到整个屏幕


谢谢你的帮助

将此CSS添加到您的body类中

body.custom-background {
background: url('/wp/wp-content/themes/twentyfourteen/assets/BG.jpg');
background-size: auto 100%;
background-size: cover;
background-position: center center;
background-attachment: fixed;
}

您需要查看CSS的background属性,然后将其应用于包含所有内容的父html元素。对于您声明的网站,它将是body元素

在此处查看背景的不同属性:

下面是我反复使用的一个例子:

/* Global Container */
.globalContainer {
width: 100%;
background: url(../PATHTOYOURPHOTO) no-repeat center bottom fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

您可以自己查找“背景大小”属性,但封面通常会缩放照片以填充整个屏幕,而不是拉伸。但是,根据屏幕大小,图像的某些部分可能会被忽略。

显示您正在使用的代码??