【问题标题】:Background of div doesn't center relative to page in chromediv的背景不相对于chrome中的页面居中
【发布时间】:2014-02-25 01:52:57
【问题描述】:

我正在尝试使用 2 张图片创建磨砂玻璃效果,一张是页面背景,一张是看起来像磨砂的背景。为此,我使用以下代码:

body {
    background: url(interferentie.png) no-repeat center center fixed;
    background-size: cover;
}

#centerlogo {
    width:600px;
    height:200px;
    background:url(interferentie_lensblur.png) center center fixed;
    background-size:cover;
    top:50%;
    left:50%;
    margin-left:-300px;
    margin-top:-100px;
    position:absolute;
}

在 Firefox 中,这可以正常工作。但在 chrome 中,div 的背景不会居中。您可以在此处查看示例:http://www.wavelengthfestival.nl

在 chrome 中,似乎 div 的背景只是从 div 开始的地方开始。有人知道这个问题的解决方案吗?

【问题讨论】:

  • 你能说得更具体一些吗?它看起来对我来说很重要。也许截图会有所帮助
  • 对我来说看起来不错。 Ubuntu 上的 Chrome 34
  • 在 windows chrome 32 上也很好看
  • s4.postimg.org/f2wa717ct/screen.png 这是我看到的截图。包含波长标志的中心 div 应与背景匹配。在 Firefox 中看起来不错:s4.postimg.org/p1h8tigsd/correct.png

标签: css google-chrome html background center


【解决方案1】:
#centerlogo   margin-left:auto   margin-right:auto

【讨论】:

猜你喜欢
  • 2019-09-18
  • 2016-03-04
  • 1970-01-01
  • 2014-06-04
  • 2012-02-11
  • 2021-01-11
  • 1970-01-01
  • 2014-04-11
  • 1970-01-01
相关资源
最近更新 更多