How to make background image fit correctly inside a board without losing responsiveness

前端 未结 3 944
旧巷少年郎
旧巷少年郎 2021-01-06 20:36

I have code in which there is class box, i have given backgroundimage to class box box1.

my problem is that the im

3条回答
  •  盖世英雄少女心
    2021-01-06 21:06

    If you want your image to cover it's container you can use background-size: cover;,

    If you want make sure the whole image is being displayed (but being resized if needed), you can use background-size: contain;

    The above two requires explicit width & height in the class box1

提交回复
热议问题