使用基础zurb网格时,一些随机列会崩溃,为什么?
<div class="small-centered">
<div class="row small-12 small-centered">
<?php foreach ($videos as $video): ?>
<div class="column small-6 medium-4 large-4">
<div>short text</div>
<img src="https://placehold.it/150x150" />
</div>
<?php endforeach; ?>
</div>
</div>
答案 0 :(得分:1)
编辑:
您需要在最后一个元素中添加.end
。使用计数器并像这样修改foreach
循环(您可能需要稍微调整一下:
<?php
$i = 0;
$len = count($videos);
foreach ($videos as $video):
if ($i == $len - 1) {
echo '<div class="column large-4 end">'; //this is the last
} else {
echo '<div class="column large-4">'; // if not last-echo normally...
} ?>
<div>short text</div>
<img src="https://placehold.it/150x150" />
</div>
<?php $i++;
endforeach; ?>