這是我的代碼:如何在Yii中添加內聯CSS來下拉菜單?
<?php echo $form->dropDownList($model, 'type', CHtml::listData($ab->type, 'id', 'name'), array('class' => 'edit'), array('width:165px')); ?>
我試圖內聯CSS添加到我的下拉列表中,但我的例子不工作。爲什麼?
這是我的代碼:如何在Yii中添加內聯CSS來下拉菜單?
<?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;')); ?
最好是投票以前的答案,而不是發佈完全相同的答案。 – hamed 2015-04-01 14:29:19
你有沒有嘗試這個辦法:陣列( '風格'=> '寬度:165像素') – 2015-04-01 14:15:31
我試過了,但仍然不工作 – 2015-04-01 14:18:07
好吧..這個?數組('class'=>'edit','style'=>'width:165px') – 2015-04-01 14:25:16