如何将按钮(提交)恰好对齐到文本或搜索框的右侧,
与搜索框高度相同,
并且在搜索框和按钮之间没有任何水平空白?
这是我的
<input type="text" value="" placeholder="search text here" style="display: block; width: 100px; height: 32px; margin: 0px; padding: 0px; float: left;" />
<input type="submit" value=" OK " style="display: block; margin: 0px; width: 20px; height: 32px; padding: 0px; float: left; border-left: none;" />
但是按钮的高度和文本框的高度都不一样
,更重要的是,我似乎无法摆脱文本框和按钮之间的 0.5 到 1 毫米的空间。
最佳答案
<input type="text" value="" placeholder="search text here" class="txtbox" />
<input type="submit" value=" OK " class="btncls" />
.txtbox{
display: block;
float: left;
height: 32px;
width: 100px;
}
.btncls{
display: block;
float: left;
height: 40px;
margin: -1px -2px -2px;
width: 41px;
}
或检查 Fiddle http://jsfiddle.net/Ggg2b/9/
关于html - 如何将按钮无边距地对齐到文本框的右侧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18201704/