Set size on background image with CSS?

后端 未结 18 1787
野性不改
野性不改 2020-11-22 12:38

Is it possible to set the size of the background image with CSS?

I want to do something like:

background: url(\'bg.gif\') top repeat-y;
background-si         


        
18条回答
  •  甜味超标
    2020-11-22 13:16

    You have written

    background: url('bg.gif') top repeat-y;    
    background-size: 490px;
    

    but you will only see the background depending on the size of the container.

    if you have an empty container with the background url and whatever the background-size is, you will not see the bg.gif.

    If you set the size of the continer to

    background: url('bg.gif') top repeat-y;    
    background-size: 490px;
    height: 490px;
    width: 490px;
    

    combined to the code you wrote above, you will be able to see the bg.gif file.

提交回复
热议问题