嗨,我正在做蛋糕php.I创建了一个代码为
的单选按钮<?php echo $form->radio('ElemType', array('M'=>'Male','F'=>'Female'),
array('class'=>'inputType', 'legend'=>false));?>
它显示单选按钮我的问题是它在单选按钮和之间保持很大的空间 label.Please给我sugg去除空间
答案 0 :(得分:0)
你的意思是标签和单选按钮之间的线间距? 好吧很简单,使用这个,
<?php echo $this->Form->input('ElemType', array('type' =>'radio', 'option'=>('M'=>'Male', 'F' =>'Female'), 'legend' => false, 'div' => false)); ?>
答案 1 :(得分:0)
要修改这些标签的显示,您可以使用周围的div
echo '<div class="inline_labels">';
echo $this->Form->radio('ElemType', $options, $attributes);
echo '</div>';
并使用这样的CSS:
.inline_labels label
{
display: inline-block;
}
答案 2 :(得分:0)
这肯定会解决Cake用户的问题
<style type="text/css">
input[type=radio] {
margin:3px;
width:23px;
}
.locRad {
margin:3px 0px 0px 3px;
float:none;
}
</style>
<label>Select Payment Type</label>
<?php
$attributes=array('legend'=>false, 'label'=>false, 'value'=>'US', 'class'=>'locRad validate[required]');
echo $form->radio('Payment.type',array('M'=>'Male','F'=>'Female'),$attributes);
?>
答案 3 :(得分:0)
简单,您只需要使用属性&#39;分隔符&#39;
example:
<?php
$options=array('M'=>'Male'."<br>" , 'F'=>'Female');
$attributes=array('legend'=>false,'label'=>'gender_male.','class'=>'radio', 'div' => false, 'separator' => ' ');
echo $this->Form->radio('gender',$options, $attributes);
?>