tags:

views:

288

answers:

1

http://www.jsftoolbox.com/documentation/help/12-TagReference/html/h_selectOneRadio.html

How to set the width of h:selectOneRadio using the styleClass attribute, I would like to enforce a similar width for all elements within the above radio button group.

+2  A: 

Imagine that you have this kind of code:

<h:form id="foo">
    <h:selectOneRadio id="bar" value="#{...}">
        ...
    </h:selectOneRadio>
    ...

Then, in your CSS, you can try to do that:

table#foo\:bar > td {
    width: 42px;
}

or

table#foo\:bar > tr > td {
    width: 42px;
}

or

table#foo\:bar td {
    width: 42px;
}

(I don't remember exactly how the parent relationship in CSS work, that's why I suggest these three examples)

In CSS, it means affect a 42px width to all elements <td> that have a <tr> parent, which have a <table> parent with the ID foo:bar

romaintaz
The colon `:` is indeed an illegal identifier in CSS. You need to escape it by backslash, i.e. `table#foo\:bar`.
BalusC
@BalusC You're totally right. I remember that I used that more than one year ago because I encountered this problem ;)
romaintaz
@romaintaz thanks for the detailed answer
Samuel