Ранее я задавал вопрос о размещении 2 div внутри другого контейнера начальной загрузки div (1 вверху слева и 1 внизу справа), который теперь решен.
Моя следующая проблема заключается в том, что в основном блоке (с двумя блоками внутри) мне нужно большое фоновое изображение, которое является отзывчивым, поэтому нижний правый блок перемещается вверх и внутрь, поскольку браузер становится меньше.
Вот что у меня есть до сих пор:
<style>
#header {
background-image: url(/images/background-image.jpg);
position: relative;
}
#header .container {
height: 893px;
position: relative;
}
#header .div1 {
position: absolute;
top: 20px;
}
#header .div2 {
position: absolute;
bottom: 20px;
right: 20px;
}
<div id="header">
<div class="container">
<div class="div1">
Top left content
</div>
<div class="div2">
Bottom right content
</div>
</div>
Adding the background image to the CSS like how I have done above, does not make the image responsive, but if I add it to the HTML as an image I cannot get the divs to sit on top of the image.
Каков правильный способ сделать это?