CSS -moz-focus-inner

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1433232/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 21:04:46  来源:igfitidea点击:

-moz-focus-inner

cssinternet-explorerfirefoxopera

提问by Dorjan

In another question I asked about alignment this was given to me to answer the question about firefox being a twit. It worked but it has left a sour taste in my mouth and I'll explain why.

在我问到的关于对齐的另一个问题中,这是为了回答关于 Firefox 是一个傻瓜的问题。它起作用了,但它在我嘴里留下了酸味,我会解释原因。

button::-moz-focus-inner { 
  border: 0;
  padding: 0;
}

Opera (10 for this example), Firefox (3 for this example) and Internet Explorer (7 for this example) all display an input[type="submit"]button differently. This focus-innerproperty is default 0 on Opera 10, something like 5px for firefox and must be 6px for Internet explorer.

Opera(本例为 10)、Firefox(本例为 3)和 Internet Explorer(本例为 7)都以input[type="submit"]不同方式显示按钮。此focus-inner属性在 Opera 10 上默认为 0,类似于 Firefox 的 5px,Internet Explorer 必须为 6px。

How can I "blanket" reset them all to 0? Is there an standard CSS call that will not only do the above but will set this hidden property for IE too?

我怎样才能“一揽子”将它们全部重置为 0?是否有标准的 CSS 调用不仅可以执行上述操作,还可以为 IE 设置此隐藏属性?

采纳答案by n1313

The reason why this is happening is simple: because all these browsers are made by different people. Try looking at your buttons from Safari, for example. There is no such thing as one css rule that will force all buttons in all major browsers look the same.

发生这种情况的原因很简单:因为所有这些浏览器都是由不同的人制作的。例如,尝试在 Safari 中查看您的按钮。没有一个 css 规则会强制所有主要浏览器中的所有按钮看起来都一样。

Well, actually you can achieve pixel-perfection, if you treat every one of them personally, like this. And you can always use <input type="image">, that will do the trick for sure.

嗯,实际上你可以实现像素完美,如果你像这样对待他们中的每一个人。而且您始终可以使用<input type="image">,这肯定可以解决问题。