Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.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 DIV'上的CSS背景图像;垂直中心_Html_Css - Fatal编程技术网

Html DIV'上的CSS背景图像;垂直中心

Html DIV'上的CSS背景图像;垂直中心,html,css,Html,Css,我有一个div,我需要使用CSS将一个小的背景图像放到该div的垂直中心 有人能帮忙吗 谢谢 #somediv { background: url (image.jpg) no-repeat 50% 50%; } 50%的压力使其水平和垂直居中。。或者,您可以使用居中垂直居中: #con { background: url(image.jpg) no-repeat left center; } #con { background: url(image.jpg) no-repe

我有一个div,我需要使用CSS将一个小的背景图像放到该div的垂直中心

有人能帮忙吗

谢谢

#somediv {
background: url (image.jpg) no-repeat 50% 50%;
}
50%的压力使其水平和垂直居中。。或者,您可以使用
居中

垂直居中:

#con {
    background: url(image.jpg) no-repeat left center;
}
#con {
    background: url(image.jpg) no-repeat center top;
}
水平居中:

#con {
    background: url(image.jpg) no-repeat left center;
}
#con {
    background: url(image.jpg) no-repeat center top;
}

从您过去的问题判断,您似乎了解背景图像。你的问题是什么?你在找背景位置吗?删除URL后的空格。删除URL后的空格