Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.9k views
Welcome To Ask or Share your Answers For Others

1 Answer

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;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...