Why do browsers create vendor prefixes for CSS properties?(为什么浏览器会为 CSS 属性创建供应商前缀?)
问题描述
Maybe it's an obvious answer, but
Why on earth would browsers decide to create their own vendor prefixes for border-radius
and the like?
I mean: Why do I have to type:
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
Is it because each platform thought "We're cool, we'll come up with a better way to do rounded corners?" It seems totally and inexplicably redundant to type three lines for one.
It's because the features were implemented by vendors before the specification reached its final release stage.
The vendor prefixes ensure that there are no clashes with changing functionality etc.
Originally, the point of vendor prefixes was to allow browser makers to start supporting experimental CSS declarations.
Let’s say a W3C working group is discussing a grid declaration (which, incidentally, wouldn’t be such a bad idea). Let’s furthermore say that some people create a draft specification, but others disagree with some of the details. As we know, this process may take ages.
Let’s furthermore say that Microsoft as an experiment decides to implement the proposed grid. At this point in time, Microsoft cannot be certain that the specification will not change. Therefore, instead of adding grid to its CSS, it adds -ms-grid.
The vendor prefix kind of says "this is the Microsoft interpretation of an ongoing proposal." Thus, if the final definition of grid is different, Microsoft can add a new CSS property grid without breaking pages that depend on -ms-grid
Source.
这篇关于为什么浏览器会为 CSS 属性创建供应商前缀?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么浏览器会为 CSS 属性创建供应商前缀?


- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01