font-size样式不适用于jsf selectOneRadio

时间:2011-12-15 18:16:23

标签: css jsf-2

我无法在jsf中修改selectOneRadio中itemLabel的字体大小,我可以更改颜色但不能更改大小。

这是我的代码:

<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>

他们有什么想法来解决这个问题? 谢谢你的帮助。

我的配置:jsf 2和tomcat 7

1 个答案:

答案 0 :(得分:1)

应该可以正常工作。请在Firebug的帮助下检查生成的HTML。 <h:selectOneRadio>生成一个HTML <table>元素,其中包含<td>元素中的标签。显然你在一些CSS样式表中有一个类似

的声明
td {
    font-size: 10pt;
}

优先于font-size:7pt;元素上的内联<table>声明。你需要微调CSS。最好通过提供一个普通的CSS样式类来完成(无论如何使用内联CSS是一种不好的做法):

<h:selectOneRadio styleClass="choices">

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