如何使div里面的输入框垂直居中?????? <input style="text-align:center"> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 垂直居中可以对div有效吗。我的IE似乎不能。 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> to net_lover我要的效果是,div中的input在div中的位置是垂直居中,而不是input中的文字垂直居中,你的代码我试过了,不行 <div style="height:200"><table align=center height=100%><tr align=center><td valign=middle><input></td></tr></table></div> 回复人: eastnofail(Char *) ( ) 信誉:100 2004-10-22 14:39:00 得分: 0 ---------------------在你的代码里,文字居中不是因为你定义了vertical-align:middle;而是因为你定义了line-height:200px; 同意楼上,似乎只能是用表格了,要不直接指定INPUT的位置 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> </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()> </div> 是这样么<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> to ttyp(愿赌服输)你的代码在input框正常高度(16px)的时候确实是居中的,但是我需要的input框高度只有3px,这时候,用你的方法还是不能垂直居中 F U C K C S D N :你 他 妈 的提前的太频繁了!!! 怎么查找一个字符串中某个字符出现的所有位置 客户端读写服务器端的文本文件 通过event对象获取id javascript写的类似翻页效果 函数看不懂 帮忙分析下 缺少对象的问题 关于百度首页的script 代码~求大牛帮忙~ javascript取字符串问题 如何用js统计一个网页的总访问量? 3721如何能彻彻底底的删除啊!!!恨死了...... 给事件传递函数的问题 求助,如何验证动态tr里的input值是否为空? 紧急求助:表单数据自动转发
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>
<table align=center height=100%>
<tr align=center>
<td valign=middle><input></td>
</tr>
</table>
</div>
---------------------在你的代码里,文字居中不是因为你定义了
vertical-align:middle;
而是因为你定义了
line-height:200px;
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> </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()>
</div>
<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>
,这时候,用你的方法还是不能垂直居中
你 他 妈 的提前的太频繁了!!!