Sarz Sarz - 1 month ago 13
Java Question

How can we adjust p:commandbutton size or width

My working environment is: Primefaces 4.0 with JSF 2.0
My aim is to set width of command button same in the form. I find

style="font-size:10px"
to set button's font size which is changing button's label size. I want to change button's size

Answer

You can use the style attribute in the commandButton with the css properties width and height.

<p:commandButton id="button" value="Click"                              
                 actionListener="#{myBean.doAction}" 
                 style="width:100px;height:100px"/>

To set the same value for all the commandButtons on a page,add the following css to your jsf page.

       .ui-button{
            width:100px;
            height:100px;
        }