我无法修改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
最佳答案
它应该可以正常工作。请在 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;
}
关于css - 字体大小样式不适用于 jsf selectOneRadio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8524720/