V
V
Vladimir2015-10-08 12:02:30
User interface
Vladimir, 2015-10-08 12:02:30

Correct responsive background image. How to do?

I'm trying to conjure a rubber background image in a div block. So that when the screen size changes, this very picture is compressed in width / height.
Faced such a problem: if it is not assigned a specific value in pixels (set height: auto), the picture is not shown. well, accordingly, the size does not change with such values ​​:(
{ background-image: url(/uimg/bg-up.png);
width: 100%;
max-width: 1160px;
background-repeat: no-repeat;
height: 260px ;}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Zubarev, 2015-10-08
@neodmin

background-size

I
Ivanq, 2015-10-08
@Ivanq

div:

width: 100%;
height: 100%;
background-image: ваша картинка;
background-size: cover;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question