how to change the edge of a commandButton with css?

0

I am working with primefaces and I want to round up my buttons, but I do not take the css, how can I do it, or what is the correct form I have the following code

<h:head>

 <style type="text/css">
        boton {
           border-radius: 5px;

        }
    </style>

</h:head>
<h:body>
    <h:form>              

        <br></br>
        <h:panelGrid id="panelButtons" columns="3" style="text-align:center;" width="90%">   
            <p:commandButton id="boton" value="Empleados"   styleClass="ui-priority-primary" update="dlg1" oncomplete="PF('dlg1').show();" />
        </h:panelGrid>
    
asked by Root93 23.01.2018 в 17:14
source

1 answer

0

There is an error in your CSS selector. This is what you have:

<style type="text/css">
    boton {
        border-radius: 5px;
    }
</style>

And this is what you should have:

<style type="text/css">
    #boton {
        border-radius: 5px;
    }
</style>

The numeral (#) indicates that your selector must work for the elements that have the ID attribute with the value "button", which is exactly what you have in <p:commandButton> .

Also keep in mind that JSF can add a prefix to the ID attribute of the elements when they are within a <h:form> , a <ui:repeat> , among others. In this case the easiest is to use a selector per class instead of one per ID. Your code would look like this:

<h:head>
    <style type="text/css">
        .boton {
            border-radius: 5px;
        }
    </style>
</h:head>
<h:body>
    <h:form>              
        <br></br>
        <h:panelGrid id="panelButtons" columns="3" style="text-align:center;" width="90%">   
            <p:commandButton value="Empleados"   styleClass="boton ui-priority-primary" update="dlg1" oncomplete="PF('dlg1').show();" />
        </h:panelGrid>

Greetings

    
answered by 14.02.2018 в 23:03