2016-06-15 31 views
1

我希望显示字段下面..字段显示正确..但我想申请CSS边缘..所以如何做到这一点?申请Css在symfony 1.4自动生成类

$this->setWidgets(array(
    'id'   => new sfWidgetFormInputHidden(), 
    'submission_id' => new sfWidgetFormInputText(), 
    'user_id'  => new sfWidgetFormInputHidden(), 
// 'field_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DataFields'), 'add_empty' => true)), 
    'value'   => new sfWidgetFormInputText(), 
    'duration'  => new sfWidgetFormInputText(), 
    'units'   => new sfWidgetFormChoice(array('choices' => array('In Days' => 'In Days', 'In Months' => 'In Months'))), 
    //'avg_score'  => new sfWidgetFormInputText(), 
)); 

回答

0

您可以应用CSS样式如下例子:

$w = new sfWidgetFormInputText(
    array('default' => 'Fabien'), 
    array('class' => 'foo') 
); 

您也可以尝试设置一个特定的内联样式有以下:

$w = new sfWidgetFormInputText(); 
$w->setOptions(array('default' => 'Fabien')); 
$w->setAttributes(array('style' => '"color:blue;margin-left:30px;"')); 

更多信息here在doc

希望得到这个帮助

+0

我写内联css ...所以它的工作,但在sfWidgetFormChoice页边距不能工作。 ','In Months'=>'In Months')),array(“style”=>'width:390px; margin-top:-90px')), – Harsiddhi

+0

你有没有检查生成的html?什么也看不见? – Matteo

+0

Nop ..没有HTML – Harsiddhi