Html DIV'上的CSS背景图像;垂直中心
我有一个div,我需要使用CSS将一个小的背景图像放到该div的垂直中心 有人能帮忙吗 谢谢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
#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后的空格