在我的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>
答案 0 :(得分: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>
另见:
答案 1 :(得分:0)
你可以试试这个:
<style type="text/css">
#businesses_panel .ui-panel-content {
margin-left: auto !important;
margin-right: auto !important;
}
</style>