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

前端 未结 4 1793
遥遥无期
遥遥无期 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:19

    Here is an example using the asker's parameters that will work. Some of the other answers have overcomplicated the parameters a bit. All that needs done is the background-size needs to be separated from the background-position by a forward slash /:

     background: url("../images/bkgnd-sidebar.png") left top / cover no-repeat;
    

提交回复
热议问题