Stretch and scale a CSS image in the background - with CSS only

后端 未结 22 2216
迷失自我
迷失自我 2020-11-22 01:37

I want that my background image stretch and scale depending on the browser viewport size.

I\'ve seen some questions on Stack Overflow that do the job, like

22条回答
  •  忘了有多久
    2020-11-22 01:52

    The following worked for me.

    .back-ground {
       background-image: url("../assets/background.png");
       background-size: 100vw 100vh;
    }
    

    that worked to cover the entire background on different dimensions

提交回复
热议问题