Stretch and scale CSS background

前端 未结 16 2190
难免孤独
难免孤独 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 03:09

    I would like to point out that this is equivalent to doing:

    html { width: 100%; height: 100%; }
    body { width: 100%; height: 100%; /* Add background image or gradient to stretch here. */}
    

提交回复
热议问题