How do I set the background image size in CSS?

后端 未结 3 809
隐瞒了意图╮
隐瞒了意图╮ 2021-01-29 00:50

So I have css code as follows:

.jumbobg {
    background: url(\'http://znc.mane-frame.com/static/silverleaf.png\') fixed          


        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-29 01:18

    The thing is that you have specified two backgrounds in background property (separated with comma), so you have to do the same with background-size to get their distinct values, when you specify only one value in background-size it is applied for both images, to be clear:

    background-size: 50px 80px; - this is one value

    background-size: 50px 80px, auto; - those are two values

    Use comma separator as you did in background, so for example this should work as you want:

    background-size: 50px 80px, auto;
    

提交回复
热议问题