为什么不同的浏览器需要自己的边框半径样式?

发布于 2024-12-11 12:54:12 字数 478 浏览 1 评论 0原文

我想知道这个问题有一段时间了。为什么不同的浏览器只支持 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦回梦里 2024-12-18 12:54:12

这个问题的答案基本上与此处给出的相同:

为什么CSS3中有-moz-XXX和-webkit-XXX?

“命名空间”允许供应商测试新的很酷的功能,并且如果
它们很棒,可以纳入标准中。这是
[此处]发生了什么:Mozilla 和 Webkit 团队尝试了很酷
事情,现在它们将成为标准。只是还没有完成
还没有。

The answer to this question is essentially the same given here:

Why there is -moz-XXX and -webkit-XXX in the CSS3?

That "namespacing" allows vendors to test new cool features, and if
they're great, they can be incorporated into the standards. This is
what is happening [here]: Mozilla and the Webkit team tried cool
things, and now they're going to become standard. It's just not done
yet.

旧故 2024-12-18 12:54:12

基本上,生活并不完美。理想情况下,是的,它应该标准化。对于开发浏览器的各种大公司/团体来说,这是一个老问题。 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,

变身佩奇 2024-12-18 12:54:12

最终它们都将支持标准的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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文