0
Hello I have four div with fixed size 300px each, and a table in the first div, I need that when this table exceeds the size 300px the rest of the content go to the second div and so on.
#pg1{
border: 1px solid black;
height: 600px;
width: 350px;
float: left;
top: 0px;
position: relative;
}
#pg2{
border: 1px solid black;
height: 600px;
width: 350px;
float: right;
top: 0px;
position: relative;
}
#tbl{
border: 1px solid black;
}
<div id="pg1">
<table id="tbl">
<thead>
<th>01</th>
<th>02</th>
<th>03</th>
</thead>
<tbody>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
<tr>
<th>AA</th>
<th>BB</th>
<th>CC</th>
</tr>
</tbody>
</table>
</div>
<div id="pg2">
</div>
<div id="pg3">
</div>
<div id="pg4">
</div>
There’s no way I can do this and I’ve mined the Internet.
Paulo, I did a test here and it works for me. You came to realize that the columns of your line does not reach the
300px
? Try to put in the first line<th>AAAAAAAAAAAAAAAAAAAAAAAAAAAA</th>
<th>BBBBBBBBBBBBBBBBBBBBBBBBBBB</th>
<th>CCCCCCCCCCCCCCCCCCCCCCCCCCC</th>
, This will reach up to 3 DIV.– Marconi
Okay what I need is that when the table height reaches 300px the rest of the table goes to another div
– Paulo Amaral