This is my code:
.filadisco1 {
display: flex;
display: -webkit-flex;
flex-flow: row wrap;
-webkit-flex-flow: row wrap;
justify-content:space-around;
}
.discox {
width: 250px;
height: 420px;
margin-bottom: 15px;
display: flex;
display: -webkit-flex;
flex-direction: column;
-webkit-flex-direction: column;
margin-top: 34px;
/* margin-left: 50px;*/
background-color: #212f31;
}
<div class="filadisco1">
<div class="discox">
<a class="ablanco" href="la-desvirtualizacion-de-las-ideas/">
<img class="imgdiscosx" src="<?php bloginfo('template_url'); ?>/images/jamondisco5.jpg">
</a>
<p class="parrafodisco">La Desvirtualización de las ideas (2015)</p>
<p class="parrafodescrip"> La idea sigue siendo la misma. Rock cannábico y kalimochero. La grabación [...]</p>
</div>
<div class="discox">
<a class="ablanco" href="bokerones-muertos/">
<img class="imgdiscosx" src="<?php bloginfo('template_url'); ?>/images/jamondisco4.png">
</a>
<p class="parrafodisco">Bokerones muertos (2014)</p>
<p class="parrafodescrip"> Este nuevo disco, musicalmente más tranquilo, es el tercero que hacemos juntos.[...]</p>
</div>
<div class="discox">
<a class="ablanco" href="la-democracia-ha-muerto-vol2/">
<img class="imgdiscosx" src="<?php bloginfo('template_url'); ?>/images/jamondisco3.jpg">
</a>
<p class="parrafodisco">La democracia ha muerto vol 2 (2013)</p>
<p class="parrafodescrip">Consta de siete temas de rock cannábico y kalimochero. Fernando de la Pola sigue [...]</p>
</div>
<div class="discox">
<a class="ablanco" href="la-democracia-ha-muerto-vol1/">
<img class="imgdiscosx" src="<?php bloginfo('template_url'); ?>/images/jamondisco2.jpg">
</a>
<p class="parrafodisco">La democracia ha muerto vol 1 (2012)</p>
<p class="parrafodescrip"> Ahora Fernando se junta con Dani, que ya había estado en Melilla en Jamón de Mono. Así surge [...]</p>
</div>
<div class="discox">
<a class="ablanco" href="se-busca-banda/">
<img class="imgdiscosx" src="<?php bloginfo('template_url'); ?>/images/jamondisco1.jpg">
</a>
<p class="parrafodisco">Se busca banda (2010)</p>
<p class="parrafodescrip"> Disco grabado durante el verano del 2009. Fernando decide proponerle el proyecto de producción de doce temas [...]</p>
</div>
</div>
I have the parent container and 5 children inside; Since there are 5 children, the bottom 2 at a width of 960px look centered but are not aligned with the top 3 elements.
With justify-content:space-around;
I make them have the same separation between the elements and these with the parent container, but the 2 below are centered and break the consistency. The bottom 2 children would have to be below the first 2 top elements.
Why is this happening? What can I do to fix it?
This is the natural behavior for the values
center
andspace-around
. What you want currently cannot be done in the normal way with flexbox. However, as with everything, hacks can be thought of and created to simulate this behavior.Some time ago I was looking for the same thing because I wanted the same behavior for a product gallery and I found an interesting solution.
The width of the padding divs must be: