如何格式化蛋糕php单选按钮标签

时间:2013-02-01 04:07:18

标签: cakephp-1.3

嗨,我正在做蛋糕php.I创建了一个代码为

的单选按钮
<?php echo $form->radio('ElemType', array('M'=>'Male','F'=>'Female'),
array('class'=>'inputType', 'legend'=>false));?>

它显示单选按钮我的问题是它在单选按钮和之间保持很大的空间   label.Please给我sugg去除空间

4 个答案:

答案 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' => '&nbsp;&nbsp;');
 echo $this->Form->radio('gender',$options, $attributes);
?>