【问题标题】:Screen resolution. Full screen - perfect. Normal screen - not perfect屏幕分辨率。全屏 - 完美。普通屏幕 - 不完美
【发布时间】:2013-08-30 17:45:15
【问题描述】:

我正在创建一个需要居中居中的圆形网站。背景由围绕中心图像的圆圈组成。每当我以全屏(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;
}

有没有办法解决这个问题?

【问题讨论】:

    标签: css browser resolution


    【解决方案1】:

    看不到其余代码,但如果您希望背景居中,您不希望将其设置为:

    body{
        background-position: center;
    }
    

    现在的情况是,背景仅针对一种分辨率正确居中,因为它是向左对齐的。

    【讨论】:

    • 这不是自动使它成为:中心中心(因此居中?)
    • 这不是你想要的吗?或者你可能需要类似的东西:背景位置:中心顶部;
    • 啊,是的,我以为我有这个(在早期版本中)。但问题仍然存在。
    猜你喜欢
    • 1970-01-01
    • 2012-01-01
    • 2016-06-28
    • 1970-01-01
    • 2022-12-11
    • 1970-01-01
    相关资源
    最近更新 更多