Search code examples
cssbackground-image

Does the background size apply to both images?


I have a responsive landing page with two background images. I need both images to have a background-size of 40% but I'm not sure if the way I wrote the CSS the background size is only affecting the first image.

This is my CSS:

.section-one {
   background: url(image-here.svg) left bottom no-repeat,
               url(another-image.svg) right bottom no-repeat;
   background-size: 40%;
   padding-bottom: 200px;
}

This is how the screen recording's showing the CSS. If you notice, the 40% is only being applied to the first image: enter image description here


Solution

  • Why not use the background directive shortcut all the way like this to be sure?

    CSS

    .section-one {
       background: no-repeat left bottom/40%   url('image-here.svg'),
                   no-repeat right bottom/40%  url('another-image.svg');
       padding-bottom: 200px;
    }