2
Hi, I’m creating a grid with divs
floating to the left, but when it reaches the fifth div
in blocking 1000px
, it floats to the right and not to the left as it should be and the margin-top
gets bigger for all divs
following, that is to say from the fifth element, the divs
the following are with a large spacing at their top.
See in the example of this image below:
And I want them to stay that way:
And the code I’m using is this:
HTML
<div class="center">
<div class="boxpost">
<img src="https://33.media.tumblr.com/26bf1c7107a9a765bd28aeabd15dfec5/tumblr_nwyd2kKcpH1u24qqvo1_400.gif" width="239px"/>
</div>
<div class="boxpost">
<img src="https://33.media.tumblr.com/26bf1c7107a9a765bd28aeabd15dfec5/tumblr_nwyd2kKcpH1u24qqvo1_400.gif" width="239px"/>
</div>
<div class="boxpost">
<img src="https://33.media.tumblr.com/26bf1c7107a9a765bd28aeabd15dfec5/tumblr_nwyd2kKcpH1u24qqvo1_400.gif" width="239px"/>
</div>
<div class="boxpost">
<img src="https://33.media.tumblr.com/26bf1c7107a9a765bd28aeabd15dfec5/tumblr_nwyd2kKcpH1u24qqvo1_400.gif" width="239px"/>
</div>
<div class="boxpost">
<img src="https://33.media.tumblr.com/26bf1c7107a9a765bd28aeabd15dfec5/tumblr_nwyd2kKcpH1u24qqvo1_400.gif" width="239px"/>
</div>
<div class="boxpost">
<img src="https://33.media.tumblr.com/26bf1c7107a9a765bd28aeabd15dfec5/tumblr_nwyd2kKcpH1u24qqvo1_400.gif" width="239px"/>
</div>
<div class="boxpost">
<img src="https://33.media.tumblr.com/26bf1c7107a9a765bd28aeabd15dfec5/tumblr_nwyd2kKcpH1u24qqvo1_400.gif" width="239px"/>
</div>
<div class="boxpost">
<img src="https://33.media.tumblr.com/26bf1c7107a9a765bd28aeabd15dfec5/tumblr_nwyd2kKcpH1u24qqvo1_400.gif" width="239px"/>
</div>
</div>
CSS
.center{
margin: 0 auto;
width:1024px;
}
.boxpost{
width:245px;
overflow:auto;
background-color: #f7f7f7;
border-radius: 3px;
float:left;
margin-top: 10px;
margin-left: 10px;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19) !important;
padding-bottom: 5px;
}
.profilepost{
float: left;
width: 100%;
height:50px;
border-bottom:1px solid #CCCCCC;
}
The problem is that I have to take out the Heights and always put the auto overflow, because they can come images of differentiated sizes, and even for the aesthetic of the business to get more relaxed so I put auto overflow and we have a new problem, the Divs mix, type put 4 Divs with different images, the fourth div turns the second on the site, and everything gets shuffled.
Good evening, post html and css so that we can reproduce the problem.
– Guilherme Nascimento
Good evening, on the indentation and marking just look at the moment of editing an icon with question mark that is at the top of the stackoverflow text editor, in it has tips on how to format.
– Guilherme Nascimento