CSS在IE6下背景图片居中问题

来源:百度知道 编辑:UC知道 时间:2024/05/09 10:39:16
CSS在IE6下的背景图片如何居中?
总是向右偏移一个像素啊,我要疯了,其他浏览器都正常,就IE6和IE7搞不定。

background:url({IMGDIR}/xxx.jpg) no-repeat top center;
background:url({IMGDIR}/xxx.jpg) no-repeat top 50%;
background:url({IMGDIR}/xxx.jpg) no-repeat top auto;

都试过了,就是偏右一像素,郁闷啊
注意:其他浏览器显示正常,用IETester测试就是IE6和IE7下有问题。www.artfan.cn这是首页,页脚的地方我需要那个背景图片居中。图片尺寸不纯在问题。多余的白边也不可能,因为是整体向右偏移了1像素

楼主,你应该先写center,后写top才是CSS标准

background:url({IMGDIR}/xxx.jpg) no-repeat center top

======================================================

我说错了,楼主的代码是正确的

你查看下你链接的图片是不是有多余的白边

再看你是否设置了左侧的margin,试着改为padding

======================================================

还有,楼主你是对什么标记应用的这段CSS?

有些标记的margin和padding在IE和标准浏览器上的默认值是不一样的哦

不排除使用CSS hack的可能性

在css中进行全局重设:
01.html, body, div, span, applet, object, iframe,
02.h1, h2, h3, h4, h5, h6, p, blockquote, pre,
03.a, abbr, acronym, address, big, cite, code,
04.del, dfn, em, font, img, ins, kbd, q, s, samp,
05.small, strike, strong, sub, sup, tt, var,
06.dl, dt, dd, ol, ul, li,
07.fieldset, form, label, legend,
08.table, caption, tbody, tfoot, thead, tr, th, td {
09. margin: 0;
10. padding: 0;
11. border: 0;
12. outline: 0;
13. font-weight: inherit;
14.