【发布时间】:2011-02-22 03:30:36
【问题描述】:
我需要在 css 中的网页顶部中心放置一张图片。现在,我只是在 css 中使用 background-image:,但这会将它放在页面的中间。
这是我的代码:
body {
background-image: url("theimageurlgoeshere"); //The image is 842 x 508
background-attachment:fixed;
background-position: center top;
background-repeat: no-repeat;
}
此外,更改background-position: 似乎对站点的结果没有影响。任何帮助表示赞赏。
【问题讨论】:
-
你的目标浏览器是什么?
-
不是
background-attachment:fixed;。
标签: css background-image background-position