是用jsf做的画面 但是运行后自动在页面左上角现实
怎么能让这个整体居中呢 不知道在哪写 以下是jsp的内容
<jsp:root version="2.0" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:jsp="http://java.sun.com/JSP/Page">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view>
        <html id="outputHtml1">
            <head id="outputHead1">
                <ice:outputStyle href="./resources/stylesheet.css" id="outputStyle1"/>
                <ice:outputStyle href="./xmlhttp/css/xp/xp.css" id="outputStyle2"/>
            </head>
            <body id="outputBody1" style="-rave-layout: grid">
                <ice:form id="form1">
                    <table>
                        <tr>
                            <td>
                                <h:outputText id="outputText1" style="font-size: 18px; height: 22px; left: 24px; top: 24px; position: absolute; width: 106px" value="アカウント:"/>
                            </td>
                            <td><h:inputText binding="#{Page1.textField1}" id="textField1" maxlength="4"
                                                 style="font-size: 18px; height: 24px; left: 132px; top: 24px; position: absolute; width: 108px" value="#{RequestLogin.account}"/>
                            </td>
                        </tr>
                        <tr>
                            <td><h:outputText id="outputText2" style="font-size: 18px; height: 22px; left: 24px; top: 60px; position: absolute; width: 106px" value="パスワード:"/>
                            </td>
                            <td><h:inputSecret binding="#{Page1.secretField1}" id="secretField1" maxlength="30" redisplay="true"
                                                   style="font-size: 18px; height: 24px; left: 132px; top: 60px; position: absolute; width: 108px" value="#{RequestLogin.password}"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                <h:commandButton action="#{Page1.button1_action}" id="button1"
                                                 style="font-size: 18px; height: 36px; left: 228px; top: 144px; position: absolute; width: 120px" value="ログイン"/>
                            </td>
                        </tr>
                        <tr>
                            <th colspan="2">
                                <td>
                                    <h:panelGroup id="groupPanel1" style="height: 34px; left: 12px; top: 192px; position: absolute; width: 382px">
                                        <h:messages errorClass="errorMessage" fatalClass="fatalMessage" id="messageList1" infoClass="infoMessage" style="" warnClass="warnMessage"/>
                                    </h:panelGroup>
                                </td>
                            </th>
                            
                        </tr>
                    </table>
                </ice:form>
            </body>
        </html>
    </f:view>
    
</jsp:root>

解决方案 »

  1.   

    在table标签里加入:align="center"不行么
      

  2.   

    直接把table放在<center></center>里看看
      

  3.   

    还是不行呢 是不是因为例如
    h:inputSecret binding="#{Page1.secretField1}" id="secretField1" maxlength="30" redisplay="true"
                                                       style="font-size: 18px; height: 24px; left: 132px; top: 60px; position: absolute; width: 108px" value="#{RequestLogin.password}"/>已经设置了这个密码框的位子了呢
      

  4.   

    加<center></center>标签可不可以
      

  5.   

    因为你用了 position: absolute; 这是绝对定位。
      

  6.   

    在<body>加样式 text-align:center; 
      

  7.   

    因为你用了 position: absolute; 这是绝对定位。
    不能改变位置,当你用宽屏的时候,你再看看效果!! 
      

  8.   

    直接把table放在<center></center>里看看
      

  9.   

    俺是菜鸟,这可以没
    <body><div center="middle"></div></body>