In my JSF 2 – Primefaces 3 web application, I am using <p:panelGrid> and <p:panel>. I have multiple components inside them which are left justified. I need to all to be center align. How can we do this I tried to use div but it does not work.
In my JSF 2 – Primefaces 3 web application, I am using <p:panelGrid> and
Share
Look at the generated HTML output and alter CSS accordingly.
If the HTML element which you’d like to center is a block element (
<div>,<p>,<form>,<table>, etc, or forced bydisplay: block;), then you first need to give it a known width and then you can center it relative to its parent block element using CSSmargin: 0 auto;on the element itself.If the HTML element which you’d like to center is an inline element (
<span>,<label>,<a>,<img>, etc, or forced bydisplay: inline;), then you can center it using CSStext-align: center;on its parent block element.