Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/91.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/7/css/35.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
Html 如何使用css添加居中背景_Html_Css_Background - Fatal编程技术网

Html 如何使用css添加居中背景

Html 如何使用css添加居中背景,html,css,background,Html,Css,Background,我想用这种图像作为背景。 我怎么能让它看起来“中心”(我的意思是要显示的光线,如果他们在网站的中间)使用CSS的任何屏幕分辨率,它将浏览?我的意思是在1440x1050或1920x1080或任何移动设备上以相同的方式显示 我是否必须根据访客的分辨率查找其他分辨率的图片?这需要php脚本吗 body{ background: url("imageurl.jpg") center center; } 如果要将其缩放到浏览器分辨率,也可以使用 background-size: cover;

我想用这种图像作为背景。 我怎么能让它看起来“中心”(我的意思是要显示的光线,如果他们在网站的中间)使用CSS的任何屏幕分辨率,它将浏览?我的意思是在1440x1050或1920x1080或任何移动设备上以相同的方式显示

我是否必须根据访客的分辨率查找其他分辨率的图片?这需要php脚本吗

body{
   background: url("imageurl.jpg") center center;
}
如果要将其缩放到浏览器分辨率,也可以使用

background-size: cover;

使其位于顶部中心而不是中间中心使其位于顶部。。。(Duh)和背景大小:100%使图像成为浏览器窗口的大小。

它会使图像在任何屏幕分辨率下看起来都一样吗。非常感谢。但如果必须重复,但从屏幕截图上显示的红线开始,该怎么办?
background              : url('images/background.jpg') top center no-repeat
background-size         : 100%;