2013-08-30 158 views
1

我正在创建一个需要在中间居中的圆形网站。背景由围绕中心图像的圆圈组成。每当我以全屏模式(F11快捷方式)查看我的站点时,无论我的屏幕分辨率如何,它都完美居中。屏幕分辨率。全屏 - 完美。正常屏幕 - 不完美

如果我在没有全屏的情况下查看我的网站,我的屏幕分辨率会稍微调整背景,使其不能完美居中。

对于我的背景,我有这样的代码:

* { 
padding:0; margin:0; 
} 

html, body { 
    height:100%; 
    width: 100%; 
    display: block; 
    background-color: #1a1207; 
    /* add font here */ 
    color: white; 
} 

body{ 
    background-image:url('../img/background.jpg'); 
    background-position: left; 
    background-repeat: no-repeat; 
    background-attachment: scroll; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -moz-background-position: fixed; 
    -o-background-size: cover; 
    background-size: cover; 
} 

有什么办法解决呢?

回答

1

无法看到代码的其余部分,但如果你想为中心的背景你不希望它其设置为:

body{ 
    background-position: center; 
} 

,现在是这样的,背景是只适用于一个分辨率,因为它与左侧对齐。

+0

这不是自动使它:中心(因此居中?) – nlreturns

+0

是不是你想要的?或者你可能需要这样的东西:background-position:center top; –

+0

啊,是的,我以为我有这个(是在早期版本)。但问题依然存在。 – nlreturns