Stretch and scale CSS background

前端 未结 16 2006
难免孤独
难免孤独 2020-11-22 02:28

Is there a way to get a background in CSS to stretch or scale to fill its container?

16条回答
  •  既然无缘
    2020-11-22 02:47

    In one word: no. The only way to stretch an image is with the tag. You'll have to be creative.

    This used to be true in 2008, when the answer was written. Today modern browsers support background-size which solves this problem. Beware that IE8 doesn't support it.

提交回复
热议问题