Aziz Mehdaoui
Aziz Mehdaoui

Reputation: 257

font-size style doesn't work for jsf selectOneRadio

I can't modify the font size of the itemLabel in selectOneRadio in jsf, I can change color but not the size.

here is my code:

<h:selectOneRadio style="color:red; font-size:7pt;"
    value="#{myBean.choice}">
    <f:selectItem itemLabel="one" itemValue="1" />
    <f:selectItem itemLabel="two" itemValue="2" />
    <f:selectItem itemLabel="three" itemValue="3" />
</h:selectOneRadio>

is their any idea to resolve that? thank you for your help.

My config: jsf 2 and tomcat 7

Upvotes: 2

Views: 5980

Answers (1)

BalusC
BalusC

Reputation: 1108632

It should work fine. Please check the generated HTML with help of among others Firebug. The <h:selectOneRadio> generates a HTML <table> element with the labels in <td> elements. Apparently you've in some CSS stylesheet a declaration something like

td {
    font-size: 10pt;
}

which get precedence over the inline font-size:7pt; declaration on the <table> element. You'd need to finetune the CSS. This is best to be done by supplying a normal CSS style class (using inline CSS is a bad practice anyway):

<h:selectOneRadio styleClass="choices">

with

.choices td {
    color: red;
    font-size: 7pt;
}

Upvotes: 1

Related Questions