为什么不同的浏览器需要自己的边框半径样式?
我想知道这个问题有一段时间了。为什么不同的浏览器只支持 CSS border-radius 属性,如果它带有自己的特殊前缀。我不明白为什么我必须写这个:
/* For Firefox and other Gecko browsers */
-moz-border-radius: 5px;
/* For Chrome/Safari and other Webkit browsers */
-webkit-border-radius: 5px;
/* For others */
border-radius: 5px;
当我可以写这个时:
border-radius: 5px;
是否有理由要求我写前缀?为什么浏览器不都只支持 border-radius
属性?这对我来说毫无意义,为什么浏览器开发人员决定拥有不同的属性,这只会让我的生活变得更加困难。其背后是否有技术或法律原因?
I've wondered this for a while. Why do different browsers only support the CSS border-radius property if it is prefixed with their own special prefix. I don't understand why I have to write this:
/* For Firefox and other Gecko browsers */
-moz-border-radius: 5px;
/* For Chrome/Safari and other Webkit browsers */
-webkit-border-radius: 5px;
/* For others */
border-radius: 5px;
When I could just write this:
border-radius: 5px;
Is there a reason that I'm required to write the prefixes? Why don't the browsers all just support the border-radius
property? It just doesn't make sense to me, why browser developers decided to all have different properties that just make my life harder. Is there a technical or legal reason behind it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个问题的答案基本上与此处给出的相同:
为什么CSS3中有-moz-XXX和-webkit-XXX?
The answer to this question is essentially the same given here:
Why there is -moz-XXX and -webkit-XXX in the CSS3?
基本上,生活并不完美。理想情况下,是的,它应该标准化。对于开发浏览器的各种大公司/团体来说,这是一个老问题。 W3C试图制定标准,但最终你无法强迫任何人。
尝试在这个非常相关的 SO.programmers 页面阅读更多内容 - https://softwareengineering.stackexchange.com/questions/103048/why-is-it-unrealistic-to-expect-all-browsers-to-support-the-same-standards 。有关浏览器/兼容性的更多信息此处,
Basically, life isn't perfect. Ideally yes, it should be standardized. It's an old issue dealing with the various large companies/groups that develop browsers. W3C tries to make standards, but in the end you can't force anyone.
Try reading more at this very relevant SO.programmers page - https://softwareengineering.stackexchange.com/questions/103048/why-is-it-unrealistic-to-expect-all-browsers-to-support-the-same-standards . And more regarding browsers/compatibility here,
最终它们都将支持标准的
border-radius
。据我了解,当事情悬而未决时,或者出于类似的原因,他们就会这样做。(另外,不需要
-moz-border-radius
,普通的跨浏览器现在已经被Gecko支持了。我相信WebKit也是一样的,但我懒得检查了。)Eventually they will all support the standard
border-radius
. I'm given to understand they do that when things are up in the air standards-wise, or for similar reasons.(also, no need for
-moz-border-radius
, the normal cross-browser is now supported by Gecko. I believe it's the same for WebKit too, but I'm too lazy to check.)