CSS CSS3全屏背景图像 - 包含和覆盖选项

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CSS CSS3全屏背景图像 - 包含和覆盖选项相关的知识,希望对你有一定的参考价值。

body{
     background-image: url(../images/bg.jpg);
     background-repeat: no-repeat;
     background-color: #000;
     background-size:contain;
}

body{
     background-image: url(../images/bg.jpg);
     background-repeat: no-repeat;
     background-color: #000;
     background-size:cover;
}

/* best choice below */

@media screen and (max-width: 1024px) { /* Specific to this particular image */
  img.bg {
    left: 50%;
    margin-left: -512px;   /* 50% */
  }
}

以上是关于CSS CSS3全屏背景图像 - 包含和覆盖选项的主要内容,如果未能解决你的问题,请参考以下文章