如何将PanelGrid居中对齐? JSF素面 [英] How to align PanelGrid to center? JSF-Primefaces
本文介绍了如何将PanelGrid居中对齐? JSF素面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道关于此问题有很多问题,但是没有任何一个对我有用.
I know that there are many questions about this issue, but nothing worked for me properly.
我需要将PanelGrid对准中心(水平).
I need to align my PanelGrid to center(horizontal).
这是我的面板网格
<p:panelGrid styleClass="panelGridCenter">
和我的CSS:
.panelGridCenter td,.panelGridCenter tr {
text-align: center;
}
它只是将内容对齐中心,而不是panelGrid
It just aligns the content to center, but not the panelGrid
推荐答案
JSF <p:panelGrid>
组件呈现HTML <table>
元素,该元素默认为
The JSF <p:panelGrid>
component renders a HTML <table>
element which is by default a block level element. To center the block level element itself, you should set its horizontal margin to auto
instead of attempting to center its inline contents.
.panelGridCenter {
margin: 0 auto;
}
另请参见:
- 在div中将CSS居中
- Center a div in CSS
See also:
这篇关于如何将PanelGrid居中对齐? JSF素面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文