HTML – 如何在Google Chrome上修复1px保证金?

前端之家收集整理的这篇文章主要介绍了HTML – 如何在Google Chrome上修复1px保证金?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

这里有一个例子http://jsbin.com/oqisuv/

CSS

  1. body {
  2. background:#e7ebf2 url(http://i.imgur.com/R2VB6.png) center repeat-y;
  3. }
  4. .menu {
  5. width:989px;
  6. margin:auto;
  7. height:100px;
  8. background:#666666;
  9. line-height:100px;
  10. text-align:center;
  11. color:#fff;
  12. }

HTML

如果您在Google Chrome上查看上面的示例,您会看到.menu看起来像是左边距:-1px或margin-right:1px.

在Firefox& IE它看起来很棒.我该如何解决这个问题?

最佳答案
  1. @media screen and (-webkit-min-device-pixel-ratio:0) {
  2. html {
  3. margin-left: 1px;
  4. }
  5. }

Background center with chrome (bug)

  1. body {
  2. background:#e7ebf2 url(http://i.imgur.com/R2VB6.png) 50% 0 repeat-y;
  3. }
  4. @media screen and (-webkit-min-device-pixel-ratio:0) {
  5. body {
  6. background-position: 50.001% 0;
  7. }
  8. }

http://philfreo.com/blog/fixing-safaris-1px-background-image-centering-problem/

猜你在找的HTML相关文章