Home

How to override Yii's block radio button list labels and make them inline

Published on 3/16/2011


By default, Yii radio buttons, radiobuttonlists, and checkboxlists look dumb. The label is on a different line, which is not a great design.

Here’s how to fix it:

In your form style sheet (form.css), set:

input[type=radio] + label, input[type=checkbox] + label { display:inline !important; }

that’s it, you’re done.

What it does is says anytime you have a radio button with a label element directly after it, make that label inline instead of block, meaning that there won’t be a line break.

I would also recommend changing Yii’s default checkbox label positioning to before the label.

... views