我已经在Chrome中测试过了,显示正常,但是在Firefox中,输入框比预期的要大。
以下是标记:
I've tested in Chrome, it shows fine but when in Firefox, the input box is larger than expected.
<div class="form-wrapper">
<input type="search" name="Ofsearch"
placeholder="Search here..." value=""/>
<button id="searchButton" type="submit">
Search
</button>
</div>
这是样式:
.form-wrapper {
height: 80px;
clear: both;
}
.form-wrapper input {
border-radius: 10px;
border: 5px solid #E5E4E2;
margin: 2px;
height: 40px;
vertical-align: middle;
padding: 20px;
margin-top: 15px;
width: 85%;
}
.form-wrapper button {
overflow: visible;
position: absolute;
float: right;
border: 0;
padding: 0;
height: 40px;
width: 110px;
border-radius: 0 3px 3px 0;
margin: 20px -118px;
}
这是一个在fiddle上的示例。
从这个示例中,你可以看到在Chrome和Firefox中它们显示的大小不同。
当我查看这个问题时,我发现.form-wrapper input{ }
中的padding:20px
导致了这个问题。然而,当我删除它时,Firefox可以正常显示,但Chrome中输入区域变小了。想知道是否有任何方法可以使它在两个浏览器中显示相同。