У меня есть три деления со следующим css:
div#container {
width: 780px;
}
div#photos {
width: 780px;
height: 300px;
}
div#content {
position: relative;
top: -106px;
width: 780px;
}
<div id="container">
<div id="photos">photos are here</div>
<div id="content">content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer content goes here, but sits slightly on top of the photos layer</div>
</div>
Моя проблема заключается в том, что, поскольку я установил верхний слой содержимого: -106px под ним большой пробел, когда я хотел, чтобы div «container» заканчивался сразу после div «content». Я попытался установить поле margin-bottom: -106px для div «container», но это не изменило высоту div «container».
div "content" будет иметь различную высоту, как, очевидно, для текста и т. Д. Есть ли способ сделать эту работу?
Заранее спасибо:)