I have facelet 1.xhtml with the following
<h:form id="frm">
    ...
</h:form>
How render this form at the center of screen entirely?
I have facelet 1.xhtml with the following
<h:form id="frm">
    ...
</h:form>
How render this form at the center of screen entirely?
<h:head>
    <h:outputStyleSheet library="css" name="stylesheet.css/>
</h:head>   
<div id="formdiv">    
    <h:form id="frm">
        ...
    </h:form>
<div>
stylesheet.css
#formdiv {
    margin: 0 auto;
}
-Or-
<head>
    <style>
        #formdiv {
            margin: 0 auto;
        }
    </style>
</head>
<h:body>
    <div id="formdiv">    
        <h:form id="frm">
            ...
        </h:form>
    <div>
</h:body>
Also see How to center a div horizontally
 
    
     
    
    Depending on the content of your form you may need to apply the CSS style at a deeper level than an outermost div
 <div class="centred-form">
    <h:form>
       <h:panelGrid>
          ...
       </h:panelGrid>
    </h:form>
</div>
will centre the form but the panel grid will be left aligned on the form defeating the purpose.
Instead you can apply a style class to the panel grid:
    <h:form>
       <h:panelGrid styleClass="centred-form">
          ...
       </h:panelGrid>
    </h:form>
and the CSS
.centred-form {
    margin : 0 auto;
}
