怎么才能让如下代码中的INPUT垂直居中
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表格</title>
<style type="text/css">
ul {width:100%;height:100%;list-style:none}
li {float:left; height:60px;text-align:center;line-height:60px; padding-top:5px;}
li.b {border-bottom:1px solid #000;width:18%;border-right:1px solid #000; }
li.zhongjian {border-bottom:1px solid #000; width:58%;border-right:1px solid #000; }
li.you {
border-bottom:1px solid #000;
width:18%; margin-top:auto;
}
</style>
</head>
<body>
<div id="a1">
<ul>
<li class="b">生活更美好1</li>
<li class="zhongjian"><input readOnly type="text" class="igray" id="3998" name="fieldstr6" value=""></li>
<li class="you"><input readOnly type="text" class="igray" id="3999" name="fieldstr7" value=""></li>
</ul>
</div>
<div style="clear:both"></div>
<div id="a2">
<ul>
<li class="b">生活更美好2</li>
<li class="zhongjian"><textarea readOnly cols="60" id="4381" name="longstr3" rows="3"></textarea readOnly></li>
<li class="you"><span></span></li>
</ul>
</div>
<div style="clear:both"></div>
<div id="a3">
<ul>
<li class="b">生活更美好3</li>
<li class="zhongjian"><textarea readOnly cols="60" id="4381" name="longstr3" rows="3"></textarea readOnly></li>
<li class="you"><input readOnly type="text" class="igray" id="3999" name="fieldstr7" value=""></li>
</ul>
</div>
<div style="clear:both"></div>
<script type="text/javascript">
window.onload=function(){
var a=document.getElementsByTagName("div");
for(i=0;i<a.length;i++)
{
var b=a[i].getElementsByTagName("textarea");
if(b.length==0)
{
a[i].style.display='none';
}
}
}
</script>
</body>
</html>
------解决方案--------------------
你的input就放在li中,而且li中只有一个input元素,那么你调input在li中的位置就行了
如果input旁边有文字就用 vertical-align:middle;
------解决方案--------------------
添加这一个css input 在IE下line-height设置是失效的 chrome等没有问题 现在偶的解决方案就是用margin
CSS code
/* for IE */
li input
{
margin:20px;
}