remove div margin at end of row (and clear floats)

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 20, 2012   (RSS)

Re: [zaba] remove div margin at end of row (and clear floats)

By Jason - June 19, 2012

Hi,

You could try something like this.

Please note that this example has not been tested. You'll need to change variable names to match what is on your page.

<div id="container">

<?php
$recordsPerRow = 3;
$recordCount = 0;
?>

<?php foreach ($myRecords as $record): ?>

<?php if (++$recordCount % $recordsPerRow == 0): ?>
<div class="box">
<?php else: ?>
<div class="box margin10">
<?php endif ?>

// OUTPUT YOUR CONTENT HERE

</div>

<?php if ($recordCount % $recordsPerRow == 0): ?>
<div class="clearfloats"></div>
<?php endif ?>

<?php endforeach ?>


</div>


Hope this helps get you started
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] remove div margin at end of row (and clear floats)

By zaba - June 20, 2012

Thanks Jason,
spot on!!