【问题标题】:how to set height of one row in h:panelGrid如何在 h:panelGrid 中设置一行的高度
【发布时间】:2013-11-02 16:41:03
【问题描述】:

我想在 h:panelGrid 中设置一行的高度。

我怎样才能做到这一点?

这是我的 css 类:

.height8 {
    height: 8px;
}

.height0 tr td{
    height: 0%
}

页面代码:

<h:panelGrid columns="2" columnClasses="height8, height8" rowClasses="height8">
    <h:outputText value="This row"/>
    <h:outputText value=" is ok"/>

    <h:outputText value="This row"/>
    <h:outputText value=" is ok"/>

    <h:outputText value="This row" styleClass="height0"/>
    <h:outputText value=" height should be different" styleClass="height0"/>

    <h:outputText value="This row"/>
    <h:outputText value=" is ok"/>
</h:panelGrid>

样式类 height0 似乎在这里不起作用。如何在 h:panelGrid 中设置特定行的高度?

【问题讨论】:

    标签: css jsf-2


    【解决方案1】:

    你有两种方法:

    内联样式:

    <h:outputText value="This row"/>
    <h:outputText value=" is ok"/>
    
    <h:outputText value="This row" style="height: 25px"/>
    <h:outputText value=" is ok" style="height: 25px"/>
    
    <h:outputText value="This row"/>
    <h:outputText value=" is ok"/>
    

    CSS 样式:

    你的元素应该有一个 id:

    <h:outputText value="This row"/>
    <h:outputText value=" is ok"/>
    
    <h:outputText value="This row" id="customheight"/>
    <h:outputText value=" is ok" id="customheight"/>
    
    <h:outputText value="This row"/>
    <h:outputText value=" is ok"/>
    

    并在您的 CSS 文件中添加此样式:

    #customheight{
       height: 25px;
    }
    

    【讨论】:

      【解决方案2】:

      更改以下样式类应该可以工作

      .height0 tr td{
          height: 0px; //or what ever height you want to set to this row.
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-07-01
        • 2016-05-15
        • 2020-01-06
        • 1970-01-01
        • 1970-01-01
        • 2017-11-27
        • 2011-11-22
        相关资源
        最近更新 更多