在我的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>
最佳答案
align="center"
已过时。您应该改用CSS,尝试:
<style type="text/css">
.test table{
margin-left: auto !important;
margin-right: auto !important;
}
</style>
<p:panel styleClass="test">
...
</p:panel>
也可以看看:
css center div not working
CENTERING THINGS
关于css - </p:panel>的内容的水平中心对齐问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16432272/