Skip to main content Skip to docs navigation

浏览器和设备

了解 Bootstrap 支持的从现代到旧式的浏览器和设备,包括每种浏览器和设备的已知怪癖和错误。

支持的浏览器

¥Supported browsers

Bootstrap 支持所有主要浏览器和平台的最新、稳定版本。

¥Bootstrap supports the latest, stable releases of all major browsers and platforms.

不明确支持使用最新版本的 WebKit、Blink 或 Gecko 的替代浏览器,无论是直接使用还是通过平台的 Web 视图 API。但是,Bootstrap(在大多数情况下)也应该在这些浏览器中正确显示和运行。下面提供了更具体的支持信息。

¥Alternative browsers which use the latest version of WebKit, Blink, or Gecko, whether directly or via the platform’s web view API, are not explicitly supported. However, Bootstrap should (in most cases) display and function correctly in these browsers as well. More specific support information is provided below.

你可以在我们的 .browserslistrc file 中找到我们支持的浏览器范围及其版本:

¥You can find our supported range of browsers and their versions in our .browserslistrc file:



# https://github.com/browserslist/browserslist#readme

>= 0.5%
last 2 major versions
not dead
Chrome >= 60
Firefox >= 60
Firefox ESR
iOS >= 12
Safari >= 12
not Explorer <= 11

我们使用 自动前缀器 通过 CSS 前缀处理预期的浏览器支持,它使用 浏览器列表 来管理这些浏览器版本。请查阅他们的文档,了解如何将这些工具集成到你的项目中。

¥We use Autoprefixer to handle intended browser support via CSS prefixes, which uses Browserslist to manage these browser versions. Consult their documentation for how to integrate these tools into your projects.

移动设备

¥Mobile devices

一般来说,Bootstrap 支持各大平台默认浏览器的最新版本。请注意,不支持代理浏览器(例如 Opera Mini、Opera Mobile 的 Turbo 模式、UC Browser Mini、Amazon Silk)。

¥Generally speaking, Bootstrap supports the latest versions of each major platform’s default browsers. Note that proxy browsers (such as Opera Mini, Opera Mobile’s Turbo mode, UC Browser Mini, Amazon Silk) are not supported.

Chrome Firefox Safari Android Browser & WebView
Android Supported Supported v6.0+
iOS Supported Supported Supported

桌面浏览器

¥Desktop browsers

同样,大多数桌面浏览器的最新版本都受支持。

¥Similarly, the latest versions of most desktop browsers are supported.

Chrome Firefox Microsoft Edge Opera Safari
Mac Supported Supported Supported Supported Supported
Windows Supported Supported Supported Supported

对于 Firefox,除了最新的正常稳定版本外,我们还支持最新的 扩展支持版本 (ESR) 版本的 Firefox。

¥For Firefox, in addition to the latest normal stable release, we also support the latest Extended Support Release (ESR) version of Firefox.

非官方的说法是,Bootstrap 在 Chromium 和 Chrome for Linux 以及 Firefox for Linux 中的外观和行为应该足够好,尽管它们没有得到官方支持。

¥Unofficially, Bootstrap should look and behave well enough in Chromium and Chrome for Linux, and Firefox for Linux, though they are not officially supported.

IE 浏览器

¥Internet Explorer

不支持 Internet Explorer。如果你需要 Internet Explorer 支持,请使用 Bootstrap v4。

¥Internet Explorer is not supported. If you require Internet Explorer support, please use Bootstrap v4.

移动设备上的模态框和下拉菜单

¥Modals and dropdowns on mobile

溢出和滚动

¥Overflow and scrolling

在 iOS 和 Android 中,<body> 元素对 overflow: hidden; 的支持相当有限。为此,当你在这些设备的浏览器中滚动经过模式的顶部或底部时,<body> 内容将开始滚动。请参阅 Chrome 错误 #175502(在 Chrome v40 中修复)和 WebKit 错误 #153852

¥Support for overflow: hidden; on the <body> element is quite limited in iOS and Android. To that end, when you scroll past the top or bottom of a modal in either of those devices’ browsers, the <body> content will begin to scroll. See Chrome bug #175502 (fixed in Chrome v40) and WebKit bug #153852.

iOS 文本字段和滚动

¥iOS text fields and scrolling

从 iOS 9.2 开始,当模式打开时,如果滚动手势的初始触摸位于文本 <input><textarea> 的边界内,则模式下方的 <body> 内容将滚动,而不是模式本身。参见 WebKit 错误 #153856

¥As of iOS 9.2, while a modal is open, if the initial touch of a scroll gesture is within the boundary of a textual <input> or a <textarea>, the <body> content underneath the modal will be scrolled instead of the modal itself. See WebKit bug #153856.

¥Navbar Dropdowns

由于 z 索引的复杂性,iOS 上的导航中未使用 .dropdown-backdrop 元素。因此,要关闭导航栏中的下拉菜单,你必须直接单击下拉元素(或 在 iOS 中将触发点击事件的任何其他元素)。

¥The .dropdown-backdrop element isn’t used on iOS in the nav because of the complexity of z-indexing. Thus, to close dropdowns in navbars, you must directly click the dropdown element (or any other element which will fire a click event in iOS).

浏览器缩放

¥Browser zooming

页面缩放不可避免地会在 Bootstrap 和 Web 的其他部分中的某些组件中出现渲染伪影。根据问题,我们也许能够修复它(首先搜索,然后根据需要打开问题)。然而,我们往往会忽略这些,因为除了一些古怪的解决方法之外,它们通常没有直接的解决方案。

¥Page zooming inevitably presents rendering artifacts in some components, both in Bootstrap and the rest of the web. Depending on the issue, we may be able to fix it (search first and then open an issue if need be). However, we tend to ignore these as they often have no direct solution other than hacky workarounds.

验证者

¥Validators

为了向旧的和有缺陷的浏览器提供最佳体验,Bootstrap 在多个地方使用 CSS 浏览器黑客 将特殊 CSS 定位到某些浏览器版本,以解决浏览器本身的错误。这些黑客行为会导致 CSS 验证器抱怨它们无效,这是可以理解的。在一些地方,我们还使用了尚未完全标准化的前沿 CSS 功能,但这些功能纯粹用于渐进增强。

¥In order to provide the best possible experience to old and buggy browsers, Bootstrap uses CSS browser hacks in several places to target special CSS to certain browser versions in order to work around bugs in the browsers themselves. These hacks understandably cause CSS validators to complain that they are invalid. In a couple places, we also use bleeding-edge CSS features that aren’t yet fully standardized, but these are used purely for progressive enhancement.

这些验证警告在实践中并不重要,因为我们的 CSS 的非 hacky 部分确实进行了完全验证,并且 hacky 部分不会干扰非 hacky 部分的正常运行,因此我们故意忽略这些特定警告。

¥These validation warnings don’t matter in practice since the non-hacky portion of our CSS does fully validate and the hacky portions don’t interfere with the proper functioning of the non-hacky portion, hence why we deliberately ignore these particular warnings.

由于我们包含了 某个 Firefox 错误 的解决方法,我们的 HTML 文档同样有一些琐碎且无关紧要的 HTML 验证警告。

¥Our HTML docs likewise have some trivial and inconsequential HTML validation warnings due to our inclusion of a workaround for a certain Firefox bug.