Problema em CSS: Div de fundo acaba antes das outras

Jammin @

Power Member
Boas estou a construir um website, neste momento só html,css e javascript, tenho uma div que serve de fundo a todas as outras, com um fundo branco, e tenho duas divs de texto, acontece que a segunda div se for muito grande como ja disse trespassa a de fundo continuando para baixo, será que me podem ajudar (queria uma margem de 25px até ao border preto)

#divbackground {
position:relative;
width: 70%;
left:15%;
right:15%;
background-color: white;
border: 5px black solid;
text-align: center;
margin: 0 auto;
height:1480px;
text-align: left;}

#main2{
position: relative;
width: 96%;
top:20px;
left:2%;
right:2%;
background-color: white;
text-align: center;}

#main3{
position: relative;
width: 96%;
top:30px;
left:2%;
right:2%;
background-color: white;
text-align: center;}

<div id="divbackground">


<div id="header"><img src="images/banner.png"></div>

<div id="menu" class="menulinks">
<a href="index.html" ><b>HOME</b></a>
<a href="index.html" ><b>INTERNATIONAL NEWS</b></a>
<a href="index.html" ><b>VIDEO CONTENTS</b></a>
<a href="index.html" ><b>REPORTAGENS</b></a>
<a href="index.html" ><b>DOWNLOADS</b></a>
<a href="index.html" ><b>FORUM</b></a>

</div>

<div id="main2"><p class="titulos">NEW ALBUM BY BOB MARLEY - "IM IN HEAVEN"</br>
<span class="sub"><img src="page.png">&nbsp;Publicado por Atum em 00:00 12/12/2000</span></p>

<p class="geral">The Republic of Poland is located in central Europe.
It borders on Germany in the west, the Czech and Slovak Republics in
the south, Lithuania, Belarus and Ukraine in the east, while its northern
border is delimited by the Baltic Sea coast and Russia (Kaliningrad district).
Warsaw is Poland's capital and the largest city. It has a population of over
1,800,000 and is located upon the longest Polish River, the Vistula. Poland
is also divided into 16 provinces or wojewodztwos (voivodeships), 314 counties
or powiats and 2,478 districts or gminas. The major Polish cities include
Krakow, Gdansk, Lodz, Katowice, Poznan, Szczecin and Wroclaw.The Republic of Poland is located in central Europe. It borders on Germany in the west, the Czech and Slovak Republics in
the south, Lithuania, Belarus and Ukraine in the east, while its northern
border is delimited by the Baltic Sea coast and Russia (Kaliningrad district).
Warsaw is Poland's capital and the largest city. It has a population of over
1,800,000 and is located upon the longest Polish River, the Vistula. Poland
is also divided into 16 provinces or wojewodztwos (voivodeships), 314 counties
or powiats and 2,478 districts or gminas.</p>

<p><img src="culture4.jpg">&nbsp;<img src="culture5.jpg"></p>

<p class="geral">The Republic of Poland is located in central Europe.
It borders on Germany in the west, the Czech and Slovak Republics in
the south, Lithuania, Belarus and Ukraine in the east, while its northern
border is delimited by the Baltic Sea coast and Russia (Kaliningrad district).
Warsaw is Poland's capital and the largest city. It has a population of over
1,800,000 and is located upon the longest Polish River, the Vistula. Poland
is also divided into 16 provinces or wojewodztwos (voivodeships), 314 counties
or powiats and 2,478 districts or gminas. The major Polish cities include
Krakow, Gdansk, Lodz, Katowice, Poznan, Szczecin and Wroclaw.The Republic of Poland is located in central Europe. It borders on Germany in the west, the Czech and Slovak Republics in
the south, Lithuania, Belarus and Ukraine in the east, while its northern
border is delimited by the Baltic Sea coast and Russia (Kaliningrad district).
Warsaw is Poland's capital and the largest city. It has a population of over
1,800,000 and is located upon the longest Polish River, the Vistula. Poland
is also divided into 16 provinces or wojewodztwos (voivodeships), 314 counties
or powiats and 2,478 districts or gminas. </p>

</div>

<div id="main3"><p class="titulos">NEW ALBUM BY BOB MARLEY - "IM IN HEAVEN"</br>
<span class="sub"><img src="page.png">&nbsp;Publicado por Atum em 00:00 12/12/2000</span></p>

<p class="geral">The Republic of Poland is located in central Europe.
It borders on Germany in the west, the Czech and Slovak Republics in
the south, Lithuania, Belarus and Ukraine in the east, while its northern
border is delimited by the Baltic Sea coast and Russia (Kaliningrad district).
Warsaw is Poland's capital and the largest city. It has a population of over
1,800,000 and is located upon the longest Polish River, the Vistula. Poland
is also divided into 16 provinces or wojewodztwos (voivodeships), 314 counties
or powiats and 2,478 districts or gminas. The major Polish cities include
Krakow, Gdansk, Lodz, Katowice, Poznan, Szczecin and Wroclaw.The Republic of Poland is located in central Europe. It borders on Germany in the west, the Czech and Slovak Republics in
the south, Lithuania, Belarus and Ukraine in the east, while its northern
border is delimited by the Baltic Sea coast and Russia (Kaliningrad district).
Warsaw is Poland's capital and the largest city. It has a population of over
1,800,000 and is located upon the longest Polish River, the Vistula. Poland
is also divided into 16 provinces or wojewodztwos (voivodeships), 314 counties
or powiats and 2,478 districts or gminas. The major Polish cities include
Krakow, Gdansk, L0dz, Katowice, Poznan, Szczecin and Wroclaw.</p>

<p><img src="culture4.jpg">&nbsp;<img src="culture5.jpg"></p>
</div>

</div>
</div>

Não liguem aos textos é só para encher, cumprimentos
 
Tens a altura da div de background definida para 1480px, se a altura dos dois divs de texto somados for maior do que isto vão saír fora dela. Das duas uma: ou não defines a altura da div de fundo (e ela redimensiona-se dependendo do tamanho das duas divs que contém) ou escolhes um valor que seja sempre superior à soma das duas divs internas.
 
Desculpa enganei-me a versão actualizada e esta:

#divbackground{position:relative;
width: 70%;
left:15%;
right:15%;
background-color: white;
border: 3px black solid;
text-align: left;
}

Por pixeis eu descobri logo, tentei retirar a height e mesmo assim não dá, trespassa na mesma. help?
 
Muito sinceramente, não estou a ver... Acontece a mesma coisa em diferentes browsers?

Sim mas já consegui resolver:

&nbsp; <br clear="all>
&nbsp; <br clear="all>

edit: inserir mesmo antes de fechar a div geral

Para os que têm este problema parece que isto resolve.

Obrigado pela ajuda :)
 
Última edição:
Back
Topo