如何在Yii中将内联css添加到下拉列表中


How do I add inline css to dropdown in Yii?

这是我的代码:

 <?php echo $form->dropDownList($model, 'type', CHtml::listData($ab->type, 'id', 'name'), array('class' => 'edit'), array('width:165px')); ?>

我试图将内联css添加到我的下拉列表中,但我的示例不起作用。为什么?

应该是这样的:

<?php echo $form->dropDownList($model, 'type', CHtml::listData($ab->type, 'id', 'name'), array('class' => 'edit', 'style' => 'width:165px')); ?>

这应该能在中工作

<?php echo $form->dropDownList($model, 'type', CHtml::listData($ab->type, 'id', 'name'), array('class' => 'edit', 'style'=>'width:165px;')); ?