background-size in shorthand background property (CSS3)

前端 未结 5 1278
再見小時候
再見小時候 2020-11-28 23:12

I\'m trying to mix background-image and background-size properties in a shorthanded background property. Based on W3C documentation

5条回答
  •  自闭症患者
    2020-11-28 23:34

    You will have to use vendor prefixes to support different browsers and therefore can't use it in shorthand.

    body { 
            background: url(images/bg.jpg) no-repeat center center fixed; 
            -webkit-background-size: cover;
            -moz-background-size: cover;
            -o-background-size: cover;
            background-size: cover;
    }
    

提交回复
热议问题