在css的div中设置背景图片后背景图片下移如何解决

html-css014

在css的div中设置背景图片后背景图片下移如何解决,第1张

background:url(images/loginbackground.png)top no-repeat 0px 10px

等同与

background:url(images/loginbackground.png)top no-repeat

background-position: 0px 10px//水平方向(以左上角为原点,x方向)移动 0像素,垂直方向(y轴方向)即向下以动 10 像素

***注意:0px 不能省略,否则默认为x方向移动的距离。也可以设置为百分比值。

修改后:

因为你的背景图片没有设置对齐方式。把背景代码改成这样 background:url(images/templatemo_header_bg.jpg) left top no-repeat

试试

首先把a 区块化,然后给定a 一个宽高,比如:

a{

display:block

width:100px

height:100px

}

a:hover{

background:图片 no-repeat

}