0

在我拥有的 JSF-PrimeFaces webapp 中,我需要将其内容水平对齐到中心。我怎样才能做到这一点?

这是以下代码:

    <p:panel id="businesses_panel" header="#{business.businessName}" styleClass="mini-panel panel-grid tr panel-grid td panel-hover panel-header-title-small">
<div align="center">
    <p:panelGrid columns="1">
        <div class="component-spacing-top"/>
        <h:graphicImage alt="#{business.businessName}" value="#{business.logoFullPath}" class="small-panel-image" />
        <div class="component-spacing-top"/>
    </p:panelGrid>
</div>
</p:panel>
4

2 回答 2

1

align="center"已弃用。你应该改用css,你试试:

            <style type="text/css">
                .test table{
                    margin-left: auto !important;
                    margin-right: auto !important;
                }
            </style>
            <p:panel styleClass="test">
                   ...
            </p:panel>

也可以看看:

于 2013-05-08T04:30:16.643 回答
0

你可以试试这个:

<style type="text/css">
    #businesses_panel .ui-panel-content {
        margin-left:  auto !important;
        margin-right: auto !important;
    }
</style>
于 2013-05-08T09:27:45.603 回答