0

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 ?

3
  • Have you try this: array('style' => 'width:165px') Commented Apr 1, 2015 at 14:15
  • I tried, but still does not work Commented Apr 1, 2015 at 14:18
  • Ok..and this? array('class' => 'edit', 'style' => 'width:165px') Commented Apr 1, 2015 at 14:25

2 Answers 2

2

It should be like this:

<?php echo $form->dropDownList($model, 'type', CHtml::listData($ab->type, 'id', 'name'), array('class' => 'edit', 'style' => 'width:165px')); ?>
Sign up to request clarification or add additional context in comments.

Comments

0

This should work

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

1 Comment

It's better to vote up previous answer than posting exactly identical answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.