html 想要将图片在网页中居中 背景图片 现在是居左上 怎么改居中麻烦告诉帮忙看看

<br style="display:none;" /> <style type="text/css"> topbanner-bd { display: none; } body { background-: 10px 19px; background-repeat: no-repeat; background-image: url("http://pai4.qpic.cn/paipai/nshWNibcqibtShuOp1w01HdcCWBRtdm7nasm5Yc3OV0aI/2000"); </style>

第1个回答  2013-06-12
你可以这样做的,在body里做一个div,这个div是仅次于body的div,然后看你这张背景图片的宽度和高度,设好这个div的宽度和高度(等于背景图片的宽度和高度),最后把这张背景引入就好了。

这个div的css
div{
width:xxxpx;
height:xxxpx;
margin:0 auto;
background:url(图片地址);
}

如果你一定要在body下插入背景的话,可以这样试试
body{
background:url(图片地址) no-repeat top center;
}
第2个回答  2013-06-11
只用改body{margin:0 auto;float:0 auto;}是整个网页居中,因为你的背景图设置的是重复,所以图片自动就居中了
第3个回答  2013-06-10
body{margin:0 auto;background:url(图片路径) no-repeat center 0;}你图片有多大呀,要是整张作为背景的话就这样body{margin:0 auto;background:url(图片路径) no-repeat 0 0;}
第4个回答  2013-06-11

      10px 19px 微调 例如:220px 100px

       知道图片大小和主块大小(一般都是980左右),可直接计算定位

第5个回答  2013-06-14
在</style>前面加上
background-position:50% 50%;