开发者

Alignment one cell in h:panelGrid

开发者 https://www.devze.com 2023-04-07 16:28 出处:网络
How to align a particular cell inside a h:panelGrid in jsf 2.0开发者_开发知识库. I am able to align whole table by adding style in the h:panelGrid. But I need only one cell to be aligned center.

How to align a particular cell inside a h:panelGrid in jsf 2.0开发者_开发知识库. I am able to align whole table by adding style in the h:panelGrid. But I need only one cell to be aligned center.

Thanks

Brajesh


If you want to say that you need only one column (through the word cell) to be aligned center, use columnClasses

<h:panelGrid columns="3" columnClasses="basicStyle, centerStyle, basicStyle"

CSS

.basicStyle {
    /*text-align: inherit; optinal*/
}

.centerStyle{
    text-align: center;
}

Edit: Align only one cell

Declare a new grid just for the cell you want to align:

<h:panelGrid columns="2" width="800px">
    <h:outputText  value="#test" />
    <h:outputText  value="#test" />
    <h:panelGrid columnClasses="centerStyle" width="100px">
        <h:outputText  value="#test" />
    </h:panelGrid>
    <h:outputText  value="#test" />
    <h:outputText  value="#test" />
    <h:outputText value="#test" />
</h:panelGrid>
0

精彩评论

暂无评论...
验证码 换一张
取 消