How to include the background-cover value in the shorthand background property?

前端 未结 4 1790
遥遥无期
遥遥无期 2020-12-02 13:02

I am trying to set a background-image to stretch to the full extent of a

\'s width and height. The
will be of variable size,
4条回答
  •  没有蜡笔的小新
    2020-12-02 13:24

    According to the W3 and MDN, there needs to be a slash separating the backgound-size from the background-position:

    W3C example:

    p { background: url("chess.png") 40% / 10em gray  round fixed border-box; } 
    

    MDN:

    This property must be specified after background-position, separated with the '/' character.

    Opera also has some information on the background shorthand:

    http://dev.opera.com/static/dstorey/backgrounds/background-shorthand.html

提交回复
热议问题