You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matthias Kahlau <mk...@web.de> on 2006/02/08 21:22:58 UTC

Applying style to radio button / checkbox labels

Hi!


I have to add some style to the text shown with a radio button or checkbox
(using HtmlRadio or HtmlCheckbox), not to the controls themselves.

A HtmlSelectOneRadio or HtmlSelectManyCheckbox has a styleClass attribute,
but the settings do only apply to the controls themselves, not to the
labels.

My radio buttons are rendered as follows:

<td><label><input type="radio" name="Form:Frage_7_2" value="4"
class="surveyInputRadioCheck" />&#160;d</label></td>

-> There is a label element around each radio button, which is rendered
implicitely. Is it possible to set a style to that label elements?


My checkboxes are rendered as follows:

<td><input type="checkbox" name="Form:Frage_7_4" id="Form:Frage_7_4"
value="2" class="surveyInputRadioCheck" />&#160;zweite</td>

-> Unfortunately, there's no label element around the checkbox elements (Why
not?). The class surveyInputRadioCheck doesn't affect the text of the
control...


So how can I apply some style to the control's labels? I can't define a
global style for <td> or <label> elements - that could inadvertently destroy
other layouts...

The most important style I have to apply is a margin or padding to add space
between multiple columns of radiobuttons or checkboxes. That would improve
the usability of the UI...



Regards,

Matthias