检查我的演示
这是对您的 CSS 的一点更改,
.inputBox{
white-space:nowrap;
font-size:0;
}
.inputBox input{
border-left:1px solid #9AAABD;
border-top:1px solid #9AAABD;
border-bottom:1px solid #9AAABD;
border-right:1px solid #b7c2d0;
box-shadow:inset 0px 1px 3px #b7c2d0;
float:left;
}
.iconHolder{
background:#007DC0 url('arrow.gif') 50% 50% no-repeat;
width:12px;
height:18px;
line-height:12px;
font-size:16px;
float:left;
}
.iconHolder:hover{
background:#ff6600 url('arrow2.gif') 50% 50% no-repeat;
}
已编辑
谷歌浏览器更新margin:0;
:在文本框中添加零边距 ( )。对我来说在 Chrome 中运行良好。
.inputBox{
}
.inputBox input{
border-left:1px solid #9AAABD;
border-top:1px solid #9AAABD;
border-bottom:1px solid #9AAABD;
border-right:1px solid #b7c2d0;
box-shadow:inset 0px 1px 3px #b7c2d0;
float:left;
margin:0;
}
.iconHolder{
background:#007DC0 url('arrow2.png') 50% 50% no-repeat;
width:15px;
height:20px;
float:left;
}
.iconHolder:hover{
background:#ff6600 url('arrow.png') 50% 50% no-repeat;
}
UPDATE-2:带有许多类似下拉菜单的整个 HTML 页面。
<!DOCTYPE HTML>
<html>
<head>
<style>
.inputBox{
}
.inputBox input{
border-left:1px solid #9AAABD;
border-top:1px solid #9AAABD;
border-bottom:1px solid #9AAABD;
border-right:1px solid #b7c2d0;
box-shadow:inset 0px 1px 3px #b7c2d0;
float:left;
margin:0;
}
.iconHolder{
background:#007DC0 url('arrow2.png') 50% 50% no-repeat;
width:15px;
height:20px;
float:left;
}
.iconHolder:hover{
background:#ff6600 url('arrow.png') 50% 50% no-repeat;
}
</style>
</head>
<body>
<span class="inputBox">
<input type="text">
<span class="iconHolder"></span>
</span>
<span class="inputBox">
<input type="text">
<span class="iconHolder"></span>
</span>
<br/>
<span class="inputBox">
<input type="text">
<span class="iconHolder"></span>
</span>
<br/>
<table>
<tr>
<td>
<span class="inputBox">
<input type="text">
<span class="iconHolder"></span>
</span>
</td>
<td>
<span class="inputBox">
<input type="text">
<span class="iconHolder"></span>
</span>
</td>
</tr>
</table>
</body>
</html>