<分区>
<分区>
我的解决方案(插入一个按钮并将其 float 到我的文本框的右侧)是否是执行此操作的最佳解决方案,它是否也能在 HTML 5 标准下跨浏览器兼容?
我的 [+] 似乎也有点偏离顶部的中心。
<style>
#refdocs_wrapper {
border: 1px solid rgb(128,128,128);
height: 20px;
width: 179px;
}
#refdocs_button {
clip:rect(1px 200px 19px 1px);
position: absolute;
float: right;
height: 18px;
width: 18px;
}
#refdocs_input {
border: 0;
width: 154px;
padding:0px 0px 0px 2px;
}
</style>
<div id="refdocs_wrapper">
<input id="refdocs_input" type="text">
<input id="refdocs_button" type="button" value="+">
</div>
最佳答案
我认为你把事情复杂化了。
试试这个。
HTML:
<div id="refdocs_wrapper">
<input id="refdocs_input" type="text"/><input id="refdocs_button" type="button" value="+"/>
</div>
CSS:
#refdocs_wrapper {
display: inline-block;
padding: 1px;
border: 1px solid rgb(128,128,128);
line-height: 18px;
}
#refdocs_button {
padding: 0;
height: 20px;
width: 20px;
}
#refdocs_input{
width: 154px;
padding: 0px;
border: 0;
}
关于html - 文本框内右侧的按钮(这是最好的方法吗?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17301500/