Dropdown size change

How can we change the font size and size of yii2 Form objects such as Dropdown select object. font size , width , height vs vs.

2 Likes

If you wish to modify all fields within an active form you could to set the $fieldClass property on the yii\widgets\ActiveForm and implement your styles there.

If you wish to do it on a per-field basis then you should add your CSS to the options property of yii\widgets\ActiveForm

An example:

<?php $form = ActiveForm::begin(['fieldClass' => 'yourClass']); ?>
<?= $form->field($model, 'name')->textInput(['options' => ['class' => 'yourClass']]);
1 Like