How can I change column width of panel grid in PrimeFaces

Andromida picture Andromida · May 27, 2013 · Viewed 78.6k times · Source

I am working with Java EE and PrimeFaces. How can I change the column width of a panel grid in PrimeFaces? Is there an example ?

Answer

Iván picture Iván · Apr 2, 2014

You can qualify your columns inside the panelGrid using columnClasses. The following code sets different width and stick the cells content aligned to the top-side.

<h:panelGrid columns="2" style="width: 100%" columnClasses="forty-percent top-alignment, sixty-percent top-alignment">
.forty-percent {
     width: 40%;
}

.sixty-percent {
     width: 60%;
}

.top-alignment {
     vertical-align: top;
}