0

In my JSF-PrimeFaces webapp I am having and I need to horizontal-align its contents to center. How can I do that?

Here is the code for the:

    <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>
Rong Nguyen
  • 4,143
  • 5
  • 27
  • 53
Abhishek Dhote
  • 1,638
  • 10
  • 41
  • 62

2 Answers2

2

align="center" is deprecated. You should instead use css, you try:

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

See also:

Community
  • 1
  • 1
Rong Nguyen
  • 4,143
  • 5
  • 27
  • 53
0

You can try this:

<style type="text/css">
    #businesses_panel .ui-panel-content {
        margin-left:  auto !important;
        margin-right: auto !important;
    }
</style>
Mr.J4mes
  • 9,168
  • 9
  • 48
  • 90