【问题标题】:font-size style doesn't work for jsf selectOneRadio字体大小样式不适用于 jsf selectOneRadio
【发布时间】:2011-12-15 18:16:23
【问题描述】:

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

【问题讨论】:

    标签: css jsf-2


    【解决方案1】:

    它应该可以正常工作。请在 Firebug 等的帮助下检查生成的 HTML。 &lt;h:selectOneRadio&gt; 生成一个 HTML &lt;table&gt; 元素,其标签位于 &lt;td&gt; 元素中。显然你在一些 CSS 样式表中有一个类似的声明

    td {
        font-size: 10pt;
    }
    

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

    <h:selectOneRadio styleClass="choices">
    

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

    【讨论】:

      猜你喜欢
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-06
      • 2012-04-20
      • 1970-01-01
      • 2021-12-12
      相关资源
      最近更新 更多