mercredi 29 novembre 2017

Put to the next column if condition reached in HTML

I'm currently using bootstrap with laravel5.1. What I have now is a list of items and I want to add column and put the other items there if the list of items reached 4 rows. Please see my code below for reference:

@foreach($keys = [1, 2, 3, 4] as $key)
        @if($key == 1)
            <div style="background: #118C8B; padding: 20px 0;">
        @elseif($key == 2)
            <div style="background: #BCA18D; padding: 20px 0;">
        @elseif($key == 3)
            <div style="background: #F2746B; padding: 20px 0;">
        @elseif($key == 4)
            <div style="background: #F14D49; padding: 20px 0;">
        @endif  
            <div class="container">
                <div class="row">
                    <div class="col-md-3 col-sm-3">
                        <img class="center-block" src="" alt="">
                    </div>
                    <div class="col-md-9 col-sm-9">
                       @foreach($items as $item)
                         
                       @endforeach
                    </div>
                 </div> 
            </div>
@endforeach



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ngixgw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire