Firefox 在文本字段顶部添加了一个额外的像素,如何删除它?
我想创建一个像本页中的搜索栏 http://dl. dropbox.com/u/333492/search/form.html
如果您使用 chrome、opera 或 safari 加载该页面,搜索栏看起来应该如此(在 Mac 上测试)。但是,如果您使用 Firefox(至少在 mac 上使用 ff 3.5 和 3.6 进行过测试),您会看到在文本字段顶部添加了一个额外的像素,因此文本字段比按钮低 1 个像素,这看起来很丑。
我尝试删除所有可能的边框和填充,但问题仍然存在。我还注意到,当搜索按钮不存在时,它不会发生。
有人知道可能导致这种行为的原因吗?或者,更好的是,有人可以更改该页面上的 CSS 以便解决问题吗?
I want to create a search bar like one in this page http://dl.dropbox.com/u/333492/search/form.html
If you load that page with chrome, opera or safari, the search bar looks like it should (tested on mac). However, if you use firefox (tested at least with ff 3.5 and 3.6 on mac), you'll see that one extra pixel gets added on top of the text field, and thus the text field is one pixel lower than the button, which looks ugly.
I tried to remove all possible borders and paddings but the problem persists. I also noticed that it doesn't occur when the search button is not there.
Does someone have any idea on what might be causing this behavior? Or, even better, could someone alter the CSS on that page so that the problem would be fixed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于找到了一篇博客文章,解释了问题的原因并提出了部分解决问题的答案。感谢 Twitter 上的@anttisykari!
http://christophzillgens。 com/en/articles/equal-height-input-and-button-elements-in-firefox-and-safari
所以正确的答案是在 CSS 中添加以下几行:
但是,IE8 仍然破坏了我的表单,所以我必须将它们添加到两个输入元素中。
现在一切似乎都好起来了。
I finally found a blog post that explains the cause of the problem and proposes an answer that partially fixes the situation. Thanks @anttisykari in Twitter!
http://christophzillgens.com/en/articles/equal-height-input-and-button-elements-in-firefox-and-safari
So the correct answer is to add following lines to the CSS:
However, IE8 still broke my form, so I had to add these to both input elements.
Now everything seems to be ok.