今天遇到這個問題,我是想達到這個效果:
寫了如下代碼:
<style> input{ outline:none; margin:0; padding:0; } #serch_box{ width:210px; height:38px; border:1px solid #ccc; border-right:none; } #serch_btn{ background:url(index/images/serch_btn.png); width:104px; height:40px; border:none; } </style> </head> <body> <input id="serch_box" type="text" /> <input id="serch_btn" type="button" /> </body>
該代碼在FireFox下顯示是這樣:
搜索框和按鈕之間有個間距,怎么也拿不掉。
在chrome下是顯示這樣:
把你們放一塊還若即若離同行不同心是什么意思。
嘗試margin、padding等方法也不能解決竄位的問題。
最后給兩個input加了個浮動,問題解決。