Jozsef Naghi
Jozsef Naghi

Reputation: 1095

How do I add inline css to dropdown in Yii?

This is my code:

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

I am trying to add inline css to my dropdown, but my example does not work. Why ?

Upvotes: 0

Views: 795

Answers (2)

Lu&#237;s P. A.
Lu&#237;s P. A.

Reputation: 9739

It should be like this:

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

Upvotes: 2

Demodave
Demodave

Reputation: 6632

This should work

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

Upvotes: 0

Related Questions