Search code examples
phphtmlformsyii2radiobuttonlist

Yii2 customize radioList button


How to customize the look and feel of yii2 radio list button.

 <?= $form->field($model, 'gender')->radioList(array('1' => 'One', 2 => 'Two'), array('template' => "<td>{input}</td><td>{label}</td>")); ?>

I need to get the required sign only on Gender label?


Solution

  • You should check your css rules (not yii2 or bootstrap, yours) since there is no such rules by default in yii2/bootstrap.

    You could simply use :

    .form-group.required label.control-label:after {
        content: " *";
        color: #a94442;
    }