How to stretch the background image to fill a div

后端 未结 10 1161
慢半拍i
慢半拍i 2020-12-04 10:27

I want to set a background image to different divs, but my problems are:

  1. The size of image is fixed(60px).
  2. Varying div\'s size

How

10条回答
  •  盖世英雄少女心
    2020-12-04 11:26

    Add

    background-size:100% 100%;
    

    to your css underneath background-image.

    You can also specify exact dimensions, i.e.:

    background-size: 30px 40px;
    

    Here: JSFiddle

提交回复
热议问题