<input style="text-align:center">

解决方案 »

  1.   

    垂直居中可以对div有效吗。我的IE似乎不能。
      

  2.   

    to JK_10000(JK) :
    div中的文字使可以垂直居中的,代码如下:
    <html>
    <head><style>
    body{TEXT-ALIGN: center;}
    #center{ MARGIN-RIGHT: auto;
    MARGIN-LEFT: auto; 
    height:200px;
    background:#F00;
    width:400px;
    vertical-align:middle;
    line-height:200px;
    align="absmiddle";
    }
    </style>
    </head>
    <body>
    <div id="center" style="POSITION: absolute; background-color:red;width:200px;height:150px;vertical-align:absmiddle">
    <p>test content</p>
    </body>
    </html>
      

  3.   

    to net_lover我要的效果是,div中的input在div中的位置是垂直居中,而不是input中的文字垂直居中,你的代码我试过了,不行
      

  4.   

    <div style="height:200">
    <table align=center height=100%>
    <tr align=center>
    <td valign=middle><input></td>
    </tr>
    </table>
    </div>
      

  5.   

    回复人: eastnofail(Char *) ( ) 信誉:100  2004-10-22 14:39:00  得分: 0  
    ---------------------在你的代码里,文字居中不是因为你定义了
    vertical-align:middle;
    而是因为你定义了
    line-height:200px;
      

  6.   

    同意楼上,似乎只能是用表格了,要不直接指定INPUT的位置
      

  7.   

    to ttyp(愿赌服输)我把控件放到表格里面还是不能居中啊,我就这点代码,你能把中间那个控件弄到居中吗?<OBJECT id=Slider1 style="WIDTH: 320px; HEIGHT: 20px" 
    classid=clsid:373FF7F0-EB8B-11CD-8820-08002B2F4F5A VIEWASTEXT><PARAM NAME="_ExtentX" VALUE="8467"><PARAM NAME="_ExtentY" VALUE="529"><PARAM NAME="_Version" VALUE="327682"><PARAM NAME="BorderStyle" VALUE="0"><PARAM NAME="MousePointer" VALUE="0"><PARAM NAME="Enabled" VALUE="1"><PARAM NAME="OLEDropMode" VALUE="0"><PARAM NAME="Orientation" VALUE="0"><PARAM NAME="LargeChange" VALUE="5"><PARAM NAME="SmallChange" VALUE="1"><PARAM NAME="Min" VALUE="0"><PARAM NAME="Max" VALUE="100"><PARAM NAME="SelectRange" VALUE="0"><PARAM NAME="SelStart" VALUE="0"><PARAM NAME="SelLength" VALUE="0"><PARAM NAME="TickStyle" VALUE="0"><PARAM NAME="TickFrequency" VALUE="1"><PARAM NAME="Value" VALUE="0"></OBJECT> </P>
    <P>&nbsp;</P><!--  background-color:red; -->
    <div id="Layer1" style="Z-INDEX: 1; WIDTH: 400px; POSITION: absolute; TOP: 119px; HEIGHT: 6px;vertical-align:center;background-color:red"> 
    <table border=1>
    <tr>
    <td valign="middle">
    <input name="textfield" size=40 style="LEFT: 0px; WIDTH: 400px; TOP: 0px; HEIGHT: 3px">
    <td>
    </tr>
    <table>
    <div id="SliderCustom" style="POSITION: absolute;left:0px;top:10px;border-bottom: 2px solid #00;border-top:2px solid #f0f0f0;border-left:2px solid #f0f0f0;border-right:2px solid #0;width:10px;height:15px;cursor:hand;background-color:threedface;font-size:9;vertical-align:center;"
     onmousedown=MouseDown(this) onmousemove=MouseMove() onmouseup=MouseUp()>
    &nbsp;
    </div>
      

  8.   

    是这样么<div id="Layer1" style="Z-INDEX: 1; WIDTH: 400px; POSITION: absolute; TOP: 119px; HEIGHT: 6px;vertical-align:center;border:1px solid red"> 
    <table border=0 height="100%">
    <tr>
    <td valign="middle">
    <input name="textfield" size=40 style="LEFT: 0px; WIDTH: 400px; HEIGHT: 16px">
    <td>
    </tr>
    <table>
    </div>
      

  9.   

    to ttyp(愿赌服输)你的代码在input框正常高度(16px)的时候确实是居中的,但是我需要的input框高度只有3px
    ,这时候,用你的方法还是不能垂直居中
      

  10.   

    F U C K   C S D N :
    你 他 妈 的提前的太频繁了!!!