背景不是从顶部开始

时间:2017-09-12 00:39:23

标签: css

所以我正在http://development.randomrab.com

主持的网站上工作

每当我将背景附件设置为固定时,背景就从顶部开始。但是,我想要滚动背景。每当我将背景附件设置为滚动时,背景图像都会从页面中心开始。在中,您必须向下滚动才能看到背景。我尝试将背景位置更改为顶部,中心顶部,顶部中心,但没有一个工作。

我的CSS代码如下所示:

body {
color: #FFF;
font-size: 14px;
font-family: Arial, Tahoma, Verdana;
margin: 0 auto 0;
padding: 0;
line-height: 24px;
background-color: #0C0807;
background-attachment: scroll;
background-image: url(images/Rab_bg.png);
background-repeat: no-repeat;
background-position: top;
}

1 个答案:

答案 0 :(得分:0)

background-attachment: scrollbackground-attachment: initialmore info)相同。如果您重置背景附件和位置,则会将背景图像重置为顶部。然后你可以根据自己的喜好操纵它。

background-attachment: initial;
background-position: center top;

这就是你得到的: 在Chrome中: Randomrab Chrome Screenshot

在Firefox中: Randomrab Firefox Screenshot