gpt4 book ai didi

css - 如何在 h :panelGrid 中设置一行的高度

转载 作者:行者123 更新时间:2023-11-28 12:09:59 25 4
gpt4 key购买 nike

我想在 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 并在行单元格内容上使用一个类:

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

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

您可以使用 :has() 创建 CSS 规则用于选择要更改高度的行的伪选择器:

tr:has(.alt-height) {
height: ...
}

关于css - 如何在 h :panelGrid 中设置一行的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19558050/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com