gpt4 book ai didi

html - 居中背景图像偏移 1px

转载 作者:太空宇宙 更新时间:2023-11-04 14:09:10 25 4
gpt4 key购买 nike

我的网页位于一个 960 像素宽的 DIV 中,我使用以下代码将此 DIV 置于页面中间:

html,body{background: url(images/INF_pageBg.gif) center top repeat-y #777777;text-align:center;}
#container{background-color:#ffffff;width:960px;text-align:left;margin:0 auto 0 auto;}

我需要 html/body 的背景图像平铺在页面中间,它确实如此,但是如果浏览器中的可 window 格是奇数个像素宽度,那么居中背景和居中 DIV 不会一起对齐。

这只发生在 FF 中。

有人知道解决方法吗?

最佳答案

是的,这是已知问题。不幸的是,您只能固定 div 和图像宽度,或使用脚本动态更改 stye.backgroundPosition 属性。另一个技巧是将表达式放入 CSS 类定义中。

关于html - 居中背景图像偏移 1px,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/113253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com