Support 'background-size' property on older browsers?

前端 未结 6 1569
鱼传尺愫
鱼传尺愫 2020-12-16 23:06

Is there a way that I can use the CSS3 \'Background-Size\' property and then use something like Modernizr to ensure that it\'s supported in older browsers (in particular I w

6条回答
  •  没有蜡笔的小新
    2020-12-17 00:07

    Best sample to support better:

      background-image: url(bg-image.png);
    
          -webkit-background-size: 100% 100%;           /* Safari 3.0 - Old Chrome - Old Android */
             -moz-background-size: 100% 100%;           /* Gecko 1.9.2 (Firefox 3.6) */
               -o-background-size: 100% 100%;           /* Opera 9.5 */
                  background-size: 100% 100%;           /* Gecko 2.0 (Firefox 4.0) and other CSS3-compliant browsers */
    

    Don't add this, because it made problem in new firefox versions:

    -moz-border-image: url(bg-image.png) 0;    /* Gecko 1.9.1 (Firefox 3.5)
    

    Source: mozilla.org

提交回复
热议问题