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 属性创建供应商前缀?
基础教程推荐
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
