Skip to main content Skip to docs navigation
View on GitHub

Download下载

Download Bootstrap to get the compiled CSS and JavaScript, source code, or include it with your favorite package managers like npm, RubyGems, and more.下载Bootstrap以获得编译后的CSS和JavaScript、源代码,或者将其包含在您喜欢的包管理器中,如npm、RubyGems等。

Compiled CSS and JS已编译的CSS和JS

Download ready-to-use compiled code for Bootstrap v5.1.0 to easily drop into your project, which includes:下载适用于Bootstrap v5.1.0的现成编译代码,以便轻松地进入您的项目,其中包括:

This doesn’t include documentation, source files, or any optional JavaScript dependencies like Popper.这不包括文档、源文件或任何可选的JavaScript依赖项,如Popper。

Download下载

Source files源文件

Compile Bootstrap with your own asset pipeline by downloading our source Sass, JavaScript, and documentation files. 通过下载我们的源Sass、JavaScript和文档文件,使用您自己的资产管道编译Bootstrap。This option requires some additional tooling:此选项需要一些额外的工具:

Should you require our full set of build tools, they are included for developing Bootstrap and its docs, but they’re likely unsuitable for your own purposes.如果您需要我们的全套构建工具,它们将用于开发Bootstrap及其文档,但它们可能不适合您自己的用途。

Download source下载源

Examples例子

If you want to download and examine our examples, you can grab the already built examples:如果您想下载并检查我们的示例,可以获取已构建的示例:

Download Examples下载示例

CDN via jsDelivr

Skip the download with jsDelivr to deliver cached version of Bootstrap’s compiled CSS and JS to your project.跳过jsDelivr的下载,将Bootstrap编译的CSS和JS的缓存版本交付到您的项目中。

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>

If you’re using our compiled JavaScript and prefer to include Popper separately, add Popper before our JS, via a CDN preferably.如果您使用的是我们编译的JavaScript,并且希望单独包含Popper,那么最好通过CDN在JS之前添加Popper。

<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js" integrity="sha384-eMNCOe7tC1doHpGoWe/6oMVemdAVTMs2xqW4mwXrXsW0L84Iytr2wi5v2QjrP/xp" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.min.js" integrity="sha384-cn7l7gDp0eyniUwwAZgrzD06kc/tftFf19TOAs2zVinnD/C7E91j9yyk5//jjpt/" crossorigin="anonymous"></script>

Package managers包管理器

Pull in Bootstrap’s source files into nearly any project with some of the most popular package managers. 将Bootstrap的源文件拉入到几乎所有具有一些最流行的包管理器的项目中。No matter the package manager, Bootstrap will require a Sass compiler and Autoprefixer for a setup that matches our official compiled versions.无论软件包管理器是什么,Bootstrap程序都需要一个Sass编译器和Autoprefixer,以实现与官方编译版本相匹配的设置。

npm

Install Bootstrap in your Node.js powered apps with the npm package:使用npm软件包在Node.js驱动的应用程序中安装Bootstrap程序:

npm install bootstrap

const bootstrap = require('bootstrap') or import bootstrap from 'bootstrap' will load all of Bootstrap’s plugins onto a bootstrap object. 将所有Bootstrap的插件加载到bootstrap对象上。The bootstrap module itself exports all of our plugins. bootstrap模块本身导出我们所有的插件。You can manually load Bootstrap’s plugins individually by loading the /js/dist/*.js files under the package’s top-level directory.您可以分别手动加载Bootstrap程序的插件,方法是在包的顶级目录下加载/js/dist/*.js文件。

Bootstrap’s package.json contains some additional metadata under the following keys:Bootstrap的package.json在以下键下包含一些额外的元数据:

  • sass - path to Bootstrap’s main Sass source fileBootstrap程序的主Sass源文件的路径
  • style - path to Bootstrap’s non-minified CSS that’s been precompiled using the default settings (no customization)使用默认设置(无自定义)预编译的Bootstrap的非精简CSS的路径
Get started with Bootstrap via npm with our starter project!使用我们的入门项目,通过npm开始Bootstrap! Head to the twbs/bootstrap-npm-starter template repository to see how to build and customize Bootstrap in your own npm project. 前往twbs/bootstrap-npm-starter模板库,了解如何在您自己的npm项目中构建和自定义Bootstrap。Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons.包括Sass编译器、Autoprefixer、Stylelint、PurgeCSS和Bootstrap图标。

yarn

Install Bootstrap in your Node.js powered apps with the yarn package:使用the yarn package在Node.js驱动的应用程序中安装Bootstrap程序:

yarn add bootstrap

RubyGems

Install Bootstrap in your Ruby apps using Bundler (recommended) and RubyGems by adding the following line to your Gemfile:使用Bundler(推荐)和RubyGems在Ruby应用程序中安装Bootstrap,方法是在文件中添加以下行:

gem 'bootstrap', '~> 5.1.0'

Alternatively, if you’re not using Bundler, you can install the gem by running this command:或者,如果您未使用Bundler,则可以通过运行以下命令安装gem:

gem install bootstrap -v 5.1.0

See the gem’s README for further details.有关更多详细信息,请参阅gem的自述

Composer

You can also install and manage Bootstrap’s Sass and JavaScript using Composer:您还可以使用Composer安装和管理Bootstrap的Sass和JavaScript:

composer require twbs/bootstrap:5.1.0

NuGet

If you develop in .NET, you can also install and manage Bootstrap’s CSS or Sass and JavaScript using NuGet:如果您在.NET中开发,还可以使用NuGet安装和管理Bootstrap的CSSSass和JavaScript:

Install-Package bootstrap
Install-Package bootstrap.sass