M
M
mrzgt2017-01-14 19:52:36
Bootstrap
mrzgt, 2017-01-14 19:52:36

How to prevent block wrapping?

There is a code that displays info blocks, how can you prevent blocks from wrapping if they are of different heights?

<div class="row">
<?php foreach ($v as $vs) { ?>
<div class="col-xs-6 col-sm-4 col-md-4 col-lg-3">
................
    
</div>
<?php } ?>
</div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
iBird Rose, 2017-01-14
@iiiBird

put clearfix in the right places. for example like this. tobish every n-th number of divs for the necessary xs md lg, etc.

<div class="col-xs-6 col-sm-4 col-lg-3"></div>
<div class="col-xs-6 col-sm-4 col-lg-3"></div>
<div class="clearfix visible-xs"></div>
<div class="col-xs-6 col-sm-4 col-lg-3"></div>
<div class="clearfix visible-sm visible-md"></div>
<div class="col-xs-6 col-sm-4 col-lg-3"></div>
<div class="clearfix visible-xs"></div>
<div class="clearfix visible-lg"></div>
<div class="col-xs-6 col-sm-4 col-lg-3"></div>
<div class="col-xs-6 col-sm-4 col-lg-3"></div>
<div class="clearfix visible-xs"></div>
<div class="clearfix visible-sm visible-md"></div>
<div class="col-xs-6 col-sm-4 col-lg-3"></div>

A
Alexey Sklyarov, 2017-01-15
@0example

For this, it is used, which is a "line" in which 3 blocks are placed in a row, i.e. so that you do not have wrapping, you need to write a condition in the output loop so that every 3 blocks are wrapped in <div class="row"></div>
Approximately it works like this:
after each 3*n block we insert
</div><div class="row">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question