为了避免重新发明轮子,我生成使用CakePHP的形式助手,这创建了下面的标记的一种形式:格式元素和行
<div class="input select"><label for="ReportFruit">Fruit</label>
<input type="hidden" name="data[Report][Fruit]" value="" id="ReportFruit" />
<div class="checkbox"><input type="checkbox" name="data[Report][Fruit][]" value="0" id="ReportFruit0" /><label for="ReportFruit0">Banana</label></div>
<div class="checkbox"><input type="checkbox" name="data[Report][Fruit][]" value="1" id="ReportFruit1" /><label for="ReportFruit1">Apple</label></div>
<div class="checkbox"><input type="checkbox" name="data[Report][Fruit][]" value="2" id="ReportFruit2" /><label for="ReportFruit2">Pear</label>
...
</div>
</div>
在这种格式生成一串复选框:
[] Banana
[] Apple
[] Pear
[] ...
我想它们格式化,使其显示像这样: (理想情况下,我仍然可以设置的每行选项的数量,但如果没有它也没关系)
[] Banana [] Apple [] Pear
[] Mango [] Lemon [] ...
我可以使用CSS来完成此操作吗?还是我必须使用JS操作DOM(或者在输出之前使用PHP更改标记)?
工程很棒;不得不在其他地方改变一些CSS,但形式仍然看起来好 – NullUserException 2010-08-02 20:29:52
感谢换行提示,为我节省了一些头痛 – Mercurybullet 2012-06-14 22:30:22