最近,我一直看到带有“webkit”标签的问题。此类问题通常往往是与 CSS、jQuery、布局、跨浏览器兼容性问题等相关的基于 Web 的问题……
那么这个“webkit”是什么以及它与 CSS 有何关系?我还注意到各个网站的源代码中有很多 -webkit-...
属性。这两者有关系吗?
更新
因此,从到目前为止的答案来看... WebKit 是 Safari/Chrome 的 HTML/CSS Web 浏览器渲染引擎。 IE/Opera/Firefox 是否有这样的引擎?使用其中一种引擎有何区别、优缺点?例如,我可以在 Firefox 中使用 WebKit 功能吗?
最终问题... IE 支持 WebKit 吗?
更新 2
所有主要浏览器都使用不同的渲染引擎。我想这就是为什么跨浏览器兼容性问题如此之多的一个重要原因吧!
那么,是否存在某种所有浏览器都会使用的标准渲染引擎的项目或移动? HTML5 会解决跨浏览器兼容性问题吗?
More recently, I have been seeing questions with the tag "webkit". Such questions usually tend to be web-based questions relating to CSS, jQuery, layouts, cross-browers compatibility issues, etc...
So what is this "webkit" and how does it relate to CSS? I have also noticed a lot of -webkit-...
properties in the source code for various websites. Are these two related?
Update
So from the answers so far... WebKit is a HTML/CSS web browser rendering engine for Safari/Chrome. Are there such engines for IE/Opera/Firefox and what are the differences, pros and cons of using one over the other? Can I use WebKit features in Firefox for example?
The ultimate question... Is WebKit supported by IE?
Update 2
All of the major browsers use different rendering engines. I guess this is a big reason why there are so many cross-browser compatibility issues!
So, is there some kind of project or movement to a standard rendering engine that ALL browsers will use? Will HTML5 bring an end to the cross-browser compatibility issues?
发布评论
评论(14)
每个浏览器都由渲染引擎支持来绘制 HTML/CSS 网页。
IE → Trident(已停产)EdgeHTML(Trident 的清理分叉)(Edge 切换到 Blink(2019 年))Opera → Presto(自 2013 年 2 月起不再使用 Presto,考虑 Opera = Chrome,因此 Blink)有关不同领域的比较列表,请参阅网络浏览器引擎比较。
不是原生的。
Every browser is backed by a rendering engine to draw the HTML/CSS web page.
IE → Trident(discontinued)EdgeHTML (clean-up fork of Trident)(Edge switched to Blink in 2019)Opera → Presto(no longer uses Presto since Feb 2013, consider Opera = Chrome, therefore Blink nowadays)See Comparison of web browser engines for a list of comparisons in different areas.
Not natively.
除了@KennyTM 说:
-ms
EdgeHTML→ 眨眼3-ms
-moz
Presto→ 眨眼1-o
(Presto) 和-webkit
(Blink)-webkit
WebKit→ 眨眼2-webkit
< support>1) 2013 年 2 月 12 日 Opera(版本 15+)宣布他们从自己的引擎 Presto 转向名为 眨眼。
2) 2013 年 4 月 3 日 Google(Chrome 版本 28+)宣布他们将使用基于 WebKit 的眨眼引擎。
3) 2018 年 12 月 6 日 Microsoft(Microsoft Edge 79+ 稳定版)宣布他们将使用基于 WebKit 的 Blink引擎。
Addition to what @KennyTM said:
-ms
EdgeHTML→ Blink3-ms
-moz
Presto→ Blink1-o
(Presto) and-webkit
(Blink)-webkit
WebKit→ Blink2-webkit
1) On February 12 2013 Opera (version 15+) announces they moving away from their own engine Presto to WebKit named Blink.
2) On April 3 2013 Google (Chrome version 28+) announces they are going to use the WebKit-based Blink engine.
3) On December 6 2018 Microsoft (Microsoft Edge 79+ stable) announces they are going to use the WebKit-based Blink engine.
Webkit 是 Safari 和 Chrome(以及其他浏览器,但这些都是流行的)使用的 Web 浏览器渲染引擎。
CSS 选择器上的
-webkit
前缀是仅此引擎打算处理的属性,与-moz
属性非常相似。我们中的许多人都希望这种情况消失,例如-webkit-border-radius
将被标准border-radius
取代,并且您不需要多个规则对于多个浏览器,相同。这实际上是“预先规范”功能的结果,这些功能旨在在标准版本出现时不干扰标准版本。对于您的更新:...不,它实际上与 IE 无关,IE 至少在 9 之前使用不同的渲染引擎,称为 三叉戟。
Webkit is a web browser rendering engine used by Safari and Chrome (among others, but these are the popular ones).
The
-webkit
prefix on CSS selectors are properties that only this engine is intended to process, very similar to-moz
properties. Many of us are hoping this goes away, for example-webkit-border-radius
will be replaced by the standardborder-radius
and you won't need multiple rules for the same thing for multiple browsers. This is really the result of "pre-specification" features that are intended to not interfere with the standard version when it comes about.For your update:...no it's not related to IE really, IE at least before 9 uses a different rendering engine called Trident.
这已被回答并接受,但如果有人仍然想知道为什么今天事情有点混乱,你必须阅读以下内容:
http://webaim.org/blog/user-agent-string-history/
它很好地了解了 gecko、webkit 和其他主要渲染引擎是如何演变的以及什么导致了当前用户代理字符串混乱的状态。
出于 TL;DR 目的引用最后一段:
This has been answered and accepted, but if someone is still wondering why are things a bit messed up today, you'll have to read this:
http://webaim.org/blog/user-agent-string-history/
It gives a good idea of how gecko, webkit and other major rendering engines evolved and what led to the current state of messed up user-agent strings.
Quoting the last paragraph for TL;DR purposes:
-webkit-
只是 Chrome、Safari、Opera 和 iOS 浏览器所属的组。它们都有一个共同的祖先,因此它们的功能/限制(当涉及到运行 CSS 和 Javascript 时)通常仅限于该组。开发人员会将
-webkit-
后跟一些代码,这意味着该代码只能在 Chrome、Safari、Opera 和 iOS 浏览器上运行。以下是完整列表:-webkit-
(Chrome、Safari、较新版本的 Opera、几乎所有 iOS 浏览器(包括适用于 iOS 的 Firefox);基本上,任何基于 WebKit 的浏览器)-moz-
(Firefox)-o-
(旧版、WebKit 之前的版本、Opera 版本)-ms-
(Internet Explorer 和 Microsoft Edge)-webkit-
is simply a group that Chrome, Safari, Opera and iOS browsers fit into. They all have a common ancestor, so often their capabilities/limitations (when it comes to running CSS and Javascript) are confined to the group.A developer will place
-webkit-
followed by some code, meaning that the code will only run on Chrome, Safari, Opera and iOS browsers. Here is a complete list:-webkit-
(Chrome, Safari, newer versions of Opera, almost all iOS browsers (including Firefox for iOS); basically, any WebKit based browser)-moz-
(Firefox)-o-
(Old, pre-WebKit, versions of Opera)-ms-
(Internet Explorer and Microsoft Edge)有点儿。查看 Chrome 内嵌框架,它是一个 Internet Explorer 插件,使其使用Webkit引擎。唯一的怪癖是您必须说服访问者安装该插件。
更新
Chrome 浏览器内嵌框架不再受到维护或支持...
Kind of. Check out Chrome Frame, it's a plugin for Internet Explorer that makes it use the Webkit engine. The only quirk is that you have to persuade your visitors to install the plugin.
Update
Chrome Frame is no longer maintained or supported…
来源 Wikipedia
有关布局引擎的更多信息,您可以查看 此处
Source Wikipedia
For further information about layout engines you can look here
Webkit 是 Chrome 和 Safari 使用的 HTML 渲染引擎。
它支持许多以
-webkit-
为前缀的自定义 CSS 属性。Webkit is an HTML rendering engine used by Chrome and Safari.
It supports a number of custom CSS properties that are prefixed by
-webkit-
.Webkit 是 Apple Safari 浏览器和 Google Chrome 中使用的 html/css 渲染引擎。
带有 -webkit- 前缀的 css 值是特定于 webkit 的,它们通常是 CSS3 或其他非标准化功能。
回答更新2
w3c 是试图标准化这些东西的机构,他们编写规则,然后程序员编写他们的渲染引擎来解释这些规则。所以基本上 w3c 说 DIV 应该“这样”工作,引擎编写者然后使用该规则来编写代码,任何错误或对规则的误解都会导致兼容性问题。
Webkit is the html/css rendering engine used in Apple's Safari browser, and in Google's Chrome.
css values prefixes with -webkit- are webkit-specific, they're usually CSS3 or other non-standardised features.
to answer update 2
w3c is the body that tries to standardize these things, they write the rules, then programmers write their rendering engine to interpret those rules. So basically w3c says DIVs should work "This way" the engine-writer then uses that rule to write their code, any bugs or mis-interpretations of the rules cause the compatibility issues.
Webkit 是流行浏览器 Safari 和 Chrome 以及其他浏览器中使用的渲染引擎。
Webkit is the rendering engine used in the popular browsers Safari and Chrome, as well as others.
作为一名网站设计师,我遇到的一个常见问题是很多人使用 IE6+。通常没什么大不了的,除了在 CSS 中,我必须添加多个渲染语法来解析每个浏览器的每个请求。如果有一个通用的 CSS 渲染设置,让 IE 可以像 Chrome/FF/Opera 和 webkit 一样轻松读取,那就太好了。 IE 的问题是,如果我不使用所有正确的 CSS 样式和渲染,那么我的网站在使用除 IE 之外的所有浏览器时看起来和工作都很好。这可能会让顽固的 IE 客户不高兴。
例子是这样的:假设我需要一个 1px 的灰色边框,边框半径为 10%。对于 Chrome 和其他浏览器,我使用 webkit 属性。现在,对于 IE,我必须使用简单的旧 CSS 值“border: 1px Solid #E5E5E5”和“border-radius: 10%”添加单独的 CSS 样式。并不总是能保证所有 IE 浏览器版本都能获得积极的结果,但在大多数情况下,这种方法对我和许多其他人来说效果很好。
A common problem I have ran into as a website designer is that alot of people use IE6+. No big deal usually, except in CSS I have to add multiple rendering syntax' to parse each request, per browser. It would be very nice if there was a universal rendering setup for CSS that IE can read as easily as Chrome/FF/Opera and webkit. The problem with IE is that if I do NOT use ALL the proper CSS styles and rendering, than my websites look and work great using every browser except IE. This can make for an unhappy, die-hard IE customer.
Example is this: Let us say I need a 1px, grey border with a border-radius of 10%. For Chrome and others, I use the webkit property. Now, for IE, I have to add seperate CSS styles using the simple old CSS values of "border: 1px solid #E5E5E5" and "border-radius: 10%". A positive outcome is not always guaranteed over all IE browser versions, but for the most part this method works fine for me and many others.
尽管这是一篇较旧的文章,但还有另一种方法可以为旧版本的 Internet Explorer 进行渲染。 -webkit 作为 CSS 供应商前缀,您还可以下载一些 JS 应用程序并将它们放在 HTML 的 HEAD 底部。
尝试使用 Modernizr、HTML5 Shiv 和 Respond.js。这些是令人惊叹的 IE 兼容的 polyfill 脚本,它们使用 polyfill,以及其他资源,有助于更好地在 IE9 及以下版本中渲染 HTML5 元素。
要使用这些填充,如果浏览器低于所需的 IE 版本,只需添加 HTML 布尔逻辑来放置它们。示例代码是:
Even though this is an older post, there is also another method to rendering for older versions of Internet Explorer. -webkit while being a CSS Vendor Prefix, you can also download a few JS applications and place them in the bottom of the HTML's HEAD.
Try using Modernizr, HTML5 Shiv and Respond.js. These are amazing IE compatible polyfill scripts that use polyfills, and other resources which will help better render HTML5 elements in IE9 and Below.
To use these polyfills, simply add HTML boolean logic to place them, IF the browser is less than the desire IE version. Example code is:
Webkit 是流行浏览器 Safari 和 Chrome 以及其他浏览器中使用的渲染引擎
每个浏览器都由渲染引擎支持来绘制 HTML/CSS 网页。
IE → 三叉戟(已停产)
Edge → EdgeHTML(Trident 的清理分支)
火狐 → 壁虎
Opera → Presto(自 2013 年 2 月起不再使用 Presto,现在考虑 Opera = Chrome)
Safari → WebKit
Chrome → Blink(WebKit 的一个分支)。
Webkit is the rendering engine used in the popular browsers Safari and Chrome, as well as others
Every browser is backed by a rendering engine to draw the HTML/CSS web page.
IE → Trident (discontinued)
Edge → EdgeHTML (clean-up fork of Trident)
Firefox → Gecko
Opera → Presto (no longer uses Presto since Feb 2013, consider Opera = Chrome nowadays)
Safari → WebKit
Chrome → Blink (a fork of WebKit).
关于
WebEngines
特别是webKit
及其开发人员的很好的文档,您可以阅读:WebKit
A good documentation about
WebEngines
especiallywebKit
and its developers you can read at:WebKit