1
I am developing a site and in it I created a service area where through CSS, HTML, PHP and Laravel I display the content dynamically, I do a foreach...
As I do not limit how many records the user can include he can include as many as he wants what generates me a Layout problem when it does not include 3 by 3, see in the image ...
As you can see, there are only 4 registered records and the last one was at the bottom of the screen which eventually generated a white space on the right.
So I ask you: How do I adjust? Is there any way to get the size of the white space through javascript so I can help the Box via CSS?
HTML/ Blade code
<section class="servicos">
<div class="container">
<div class="row text-center">
<h2><i class="fa fa-briefcase" aria-hidden="true"></i> S e r v i c o s </h2>
<hr>
</div>
</div>
<div class="col-xs-12">
<div class="container">
@forelse($servicos as $dados_servicos)
<div class="col-xs-4">
<div class="box col-xs-12">
<div class="icone text-center">
<i class="fa {{$dados_servicos->caminhoicone}} fa-4x" aria-hidden="true"></i>
</div>
<h3 class="text-center titulo">{{$dados_servicos->titulo}} </h3>
<p class="texto">{!!$dados_servicos->post!!} </p>
</div>
</div>
@empty
Nenhum Serviço Cadastrado
@endforelse
</div>
</div>
</section>
CSS
.servicos .box{
border-radius: 3%;
text-align: center;
margin-left: 6%;
margin-top: 10px;
width: 300px;
height: 300px;
background-color:#a09f9d;
font-family: "Roboto-Light";
float: left;
/*background-color: rgba(255, 255, 255, .4);*/
cursor: pointer;
}
.servicos .box:hover{
box-shadow: 15px 15px 15px 15px rgba(0, 0, 0, 0.3);
transition: all 1.0s ease;
}
.servicos .box .icone{
margin-top: 10px;
color: white;
}
.servicos .box .titulo{
color:white;
font-family: "Roboto-Light";
overflow: hidden;
font-weight: bold;
}
.servicos .box .texto{
position: relative;
font-family: "Roboto-Light";
color: white;
margin-top: 10px;
overflow: hidden;
}
Diego you want to cover the size of the Gray Box and center it on the page, or you want it "Espiche" and occupy 100% of the remaining blank?
– hugocsl
@hugocsl, if it is a single record I intend to centralize, but there may be cases of having 2 records as well
– Diego Lela