【问题标题】:How to set Background image that cant be repeated如何设置不能重复的背景图片
【发布时间】:2013-10-29 20:11:42
【问题描述】:

在执行PSD to html 时,我有一个background image that cant be set to repeat using css repeat property because images is not consistent like a pattern,它就像一个完整的页面宽度/高度图像,需要我将其宽度高度设置为与页面相同而不重复它,所以我如何以某种方式获得它该图像也作为背景加载,并且站点速度也不会受到干扰,请帮助我,我应该简单地将其背景图像设置为container div ? 或其他东西吗??

【问题讨论】:

    标签: html css background-image dreamweaver photoshop


    【解决方案1】:

    您可以为此使用 CSS 属性:

    html { 
      background: url(images/bg.jpg) no-repeat center center fixed; /*Your image here*/
      -webkit-background-size: cover;
      -moz-background-size: cover;
      -o-background-size: cover;
      background-size: cover;
    }
    

    查看此链接了解更多信息:

    http://css-tricks.com/perfect-full-page-background-image/

    兼容性在这里:

    http://caniuse.com/background-img-opts

    PD:不要忘记前缀供应商

    【讨论】:

      猜你喜欢
      • 2015-03-14
      • 1970-01-01
      • 2019-11-16
      • 2017-10-30
      • 1970-01-01
      • 2012-04-02
      • 1970-01-01
      • 2014-07-01
      • 1970-01-01
      相关资源
      最近更新 更多