<div class="searchWrapper">
<table height="100%" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><input type="text" id="searchInput" class="searchBox" /></td>
<td><div class="searchBtn">Search</div></td>
</tr>
</table>
</div>
随着CSS:CSS - IE不显示完全正确
/* Search */
.searchWrapper
{
background-image:url(../images/menuBG.jpg);
height:45px;
width:380px;
background-position:bottom;
background-repeat:repeat-x;
background-color:#79ABC4;
}
.searchBtn
{
cursor:pointer;
border:outset 1px #ccc;
background:#999;
color:#666;
font-weight:bold;
height: 26px;
position:relative;
top:1px;
width: 75px;
background:url(../images/formbg.gif) repeat-x left top;
margin-right: 5px;
text-align:center;
line-height: 27px;
font-size: 14px;
}
.searchBox
{
width:270px;
height:25px;
font-size: 16px;
border:1px solid #3C81AA;
margin-left:5px;
line-height: 25px;
padding-left:10px;
padding-right:10px;
color: #666;
}
如果您在FF运行它,它会显示精细,假的按钮显示为相同的高度和位置作为输入框。
在IE中,虽然我无法得到它匹配,它似乎是1px关闭。假按钮的高度稍微偏小。我已经摆弄了很长时间,似乎无法想象它!
在任何人评论之前,我在这里使用表格,因为它只是使垂直对齐更容易。
我爱问题的标题,因为这是真的在数以千计的不同场合:-) – 2010-09-17 10:38:12