T
T
Taras2018-03-14 12:09:40
css
Taras, 2018-03-14 12:09:40

background: cover doesn't work why?

Good afternoon. I set 3 pictures for the header, the first picture turned out to be stretched by 100%, but cover does not work, even if you set it first. You need to set cover for all 3 pictures. I do not know what to do, I searched in Google and did not find this.
The pictures are perfectly placed, there is just an indentation at the top and bottom. using sass

.header
 background: url(../img/header/header-bgc-curtains.png) 100% no-repeat,
 url(../img/header/header-bgc.png) right no-repeat, 
 url(../img/header/header-left-img.jpg) left no-repeat
 background-color: #133f58
 height: 100vh
 width: 100vw

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sanches, 2018-03-15
@Vorteri

In such cases, always separate generic properties into specific ones:

.header {
  background-image: url('...'),  url('...'), url('...');
  background-size: cover, cover, cover;
  background-position: left center, right center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
}

https://codepen.io/abnmt/pen/VXaMBo?editors=0100

A
Alexander null, 2018-03-14
@snikes

background-size: cover; not?

A
Anton, 2018-03-14
@Eridani

background-size: cover, no?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question