DimaSan DimaSan - 1 year ago 130
CSS Question

How to align two commandButtons inside a form

I have two

elements inside
in my .xhtml page.
How to align them center?

enter image description here

Answer Source

Wrap them in a div or span content and text-align: center that div.

<div class="form-group center">
  <p:commandButton value="C1" action="#{login.login}" />
  <p:commandButton value="C2" action="#{login.login}" />
  .center {
    text-align: center;

There are many many ways to achieve this, and maybe looking into CSS could help understand it a bit more.

Helpful link: https://www.w3.org/Style/Examples/007/center.en.html#block

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download