开发者

Assigning style/class to labels of checkboxes in cakePHP

I have a a simple group of checkboxes generated by cakePHP's form

echo $form->input('Interest.interest_id', array('label' => __l('Interests'), 'multiple' => 'checkbox'));

There's a main Label called Interests and then a label for every checkbox generated, how do I apply a seperate class style to the labels of the checkboxes?

SNIPPET

<label for="InterestInterestId">Interests</label>
<input type="hidden" value="" name="data[Interest][interest_id]">
<div class="checkbox">
<input id="InterestInterestId8" type="checkbox" 开发者_如何转开发value="8" name="data[Interest][interest_id][]">
<label for="InterestInterestId8">Label of Checkbox</label>
</div>

My main objective is to have the checkbox display nicely inline infront of the label, but due to other styling it's not displaying like that in default


I see that you can distinguish your styling for the checkbox label as:

.checkbox input[type="checkbox"] {
    display: inline;
}
.checkbox label {
    display: inline;
}

That worked for me but I don't know what CSS you have for the other label that this label may be inheriting. Here is the working code:

http://jsfiddle.net/XBXVs/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜