当使用背景图像时,是否有解决方案来解决 IE 7/8 中在输入类型 = 提交上添加的额外填充? IE 7/8 的其他奇怪之处?
我一直试图找出在 IE 7/8 中的 input[type=submit] 上边框和背景图像之间的额外空间。看来如果我将背景更改为实际图像而不是仅使用颜色,IE 会添加这个额外的空间?
我发现的另一个奇怪之处是,如果您单击表单中的其中一个文本输入,它会在提交按钮周围添加 1px 黑色“轮廓”。
我在这里设置了一个演示页面 - http://bit.ly/i3XC1y
I've been trying to figure out where I am getting this extra space between the border and the background image on my input[type=submit] in IE 7/8. It seems if I change the background to an actual image instead of just using color, IE adds this extra space?
Another oddity I found, is that if you click on one of the text inputs in the form, it adds 1px black "outline" around the submit button.
I have a demo page set up here - http://bit.ly/i3XC1y
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是您问题的简单解决方案。只需在您的类中添加一行即可完成,我们来寻找解决方案:
访问 http://blog.10pixel.com/input -button-extra-width-in-ie-7-fix/ 了解更多详细信息。
Here is simple soution for your problem. Just add a sinlge line to your class, and it's done, Here we go for the solution :
Visit http://blog.10pixel.com/input-button-extra-width-in-ie-7-fix/ for more details.
我对此进行了更多研究,我发现最好的解决方案似乎在以下浏览器(IE6 - IE8、FF3.5 和 FF3.6、Chrome、Opera 和 Safari)中呈现输入非常相似,即包装我的提交用div输入。
下面是我使用的标记。
HTML
CSS
就像我说的,这似乎效果最好,当另一个输入以与提交输入相同的形式聚焦时,它消除了 IE 中额外的空白填充和悬停轮廓。
我注意到的一件小事是文本的水平对齐方式。默认情况下,提交输入似乎将值文本居中,但我注意到 FF 和其他浏览器之间存在一些差异。它不是很明显,但是如果您在提交输入上将文本对齐设置为左侧,您会注意到左边框和 FF 中的值文本之间有一点填充。当文本对齐值设置为左时,所有其他浏览器的值文本与左边框齐平。
I worked on this some more and the best solution I've found that seems to render the input very similar across the following browsers, IE6 - IE8, FF3.5 and FF3.6, Chrome, Opera, and Safari was to wrap my submit input with a div.
Below is the mark-up I used.
HTML
CSS
Like I said, this seems to work the best, it got rid of the extra white space padding in IE and hover outline when another input is focused in the same form as the submit input.
One small thing I did notice was the horizontal alignment of the text. By default, it seems the submit input centers the value text, yet I noticed some discrepancies between FF and the other browsers. Its not very noticeable, but If you set the text align to left on the submit input, you'll notice there is a little padding between the left border and the value text in FF. All other browsers the value text is flush with the left border when the text-align value is set to left.