如何在jsf中为h:panelgrid指定样式

How to specify styles for h:panelgrid in jsf

我使用简单的 h:panelGrid 来显示 table 我怎样才能为 table 指定样式以使其更好。我对我在网上看到的所有东西有点困惑 这就是我一直在使用的代码

<h:panelGrid id="panel" columns="2"  cellpadding="10"
            cellspacing="1" style="align:center;">
            <f:facet name="header">
                <h:outputText value="Registration" />
            </f:facet>
            <h:outputText value="User Name:" escape="false" />
        <h:inputText value="Hello World" />
            <h:outputText value="Password:" escape="false" />
            <h:inputSecret value="" />
        </h:panelGrid>

能否请您指定用于指定 jsf 中元素的 css 或内联样式的可选选项列表 提前致谢

不要尝试使用内联样式。由于 jsf 在这方面是一个 html 代码生成器,因此内联样式不会应用于您希望应用它们的 html 元素。使用 styleClass 属性,并为要设置样式的 html 元素使用正确的选择器创建 css。在那些选择器

中使用应用class

另见

  • How to align items in a <h:panelGrid> to the right