bootstrap、bulma、purecss、tachyons 和 tailwindcss 都是前端开发中常用的 CSS 工具库,但它们的设计哲学和适用场景截然不同。
bootstrap 和 bulma 属于组件库,提供预定义的样式类(如按钮、导航栏),适合快速搭建界面。bootstrap 包含可选的 JavaScript 交互,而 bulma 纯 CSS。
purecss 是轻量级模块化库,适合需要极简基础样式的场景。
tachyons 和 tailwindcss 属于效用类(Utility-First)框架,通过组合细粒度类名构建样式。tailwindcss 是目前的主流选择,拥有强大的配置系统和即时编译引擎;tachyons 则是该理念的先驱,目前维护频率较低。
在前端工程化中,CSS 架构的选择直接影响开发效率、维护成本和最终性能。bootstrap、bulma、purecss、tachyons 和 tailwindcss 代表了两种主要流派:组件式(Component-Based)和效用类(Utility-First)。本文将从实际工程角度对比它们的核心差异。
组件式框架提供语义化的类名,效用类框架提供原子化的样式类。
bootstrap 提供完整的组件类,如按钮。
<!-- bootstrap: 预定义组件类 -->
<button class="btn btn-primary">提交</button>
bulma 使用可读性强的类名组合。
<!-- bulma: 语义化类名 -->
<button class="button is-primary">提交</button>
purecss 提供基础模块类,需组合使用。
<!-- purecss: 模块化类名 -->
<button class="pure-button pure-button-primary">提交</button>
tachyons 使用功能型类名组合样式。
<!-- tachyons: 功能类组合 -->
<button class="btn primary ba b--primary br2 pa3">提交</button>
tailwindcss 通过原子类精确控制每个属性。
<!-- tailwindcss: 原子效用类 -->
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">提交</button>
布局系统是框架的核心,不同框架的实现方式差异巨大。
bootstrap 使用经典的行/列容器系统。
<!-- bootstrap: 容器与列 -->
<div class="container">
<div class="row">
<div class="col-6">内容</div>
<div class="col-6">内容</div>
</div>
</div>
bulma 基于 Flexbox 的列系统。
<!-- bulma: Flex 列 -->
<div class="columns">
<div class="column is-half">内容</div>
<div class="column is-half">内容</div>
</div>
purecss 使用响应式网格单元。
<!-- purecss: 响应式单元 -->
<div class="pure-g">
<div class="pure-u-1-2">内容</div>
<div class="pure-u-1-2">内容</div>
</div>
tachyons 依赖功能类手动构建布局。
<!-- tachyons: 功能类布局 -->
<div class="flex flex-wrap">
<div class="w-50">内容</div>
<div class="w-50">内容</div>
</div>
tailwindcss 提供完整的 Flex 和 Grid 效用类。
<!-- tailwindcss: 效用类布局 -->
<div class="grid grid-cols-2 gap-4">
<div>内容</div>
<div>内容</div>
</div>
主题定制决定了框架能否适应品牌需求。
bootstrap 通过 Sass 变量覆盖主题。
// bootstrap: Sass 变量覆盖
$primary: #563d7c;
@import "bootstrap";
bulma 使用 Sass 变量定制颜色和行为。
// bulma: 变量定制
$primary: #00d1b2;
@import "bulma";
purecss 定制能力有限,主要靠覆盖 CSS。
/* purecss: 手动覆盖样式 */
.pure-button-primary { background: #000; }
tachyons 通过构建步骤配置变量。
// tachyons: 构建配置
module.exports = {
colors: { primary: '#0074d9' }
}
tailwindcss 使用 tailwind.config.js 全面配置。
// tailwindcss: 配置文件
module.exports = {
theme: { extend: { colors: { primary: '#0074d9' } } }
}
交互逻辑的处理方式影响捆绑包大小和框架选择。
bootstrap 包含可选的 JavaScript 插件(v5 无 jQuery)。
// bootstrap: 内置 JS 插件
import { Modal } from 'bootstrap';
const modal = new Modal('#myModal');
bulma 纯 CSS,无内置 JS,需自行实现交互。
// bulma: 自行实现交互
document.querySelector('.button').addEventListener('click', () => {
// 手动处理逻辑
});
purecss 纯 CSS,无内置交互逻辑。
// purecss: 自行实现交互
document.querySelector('.pure-button').onclick = () => {};
tachyons 纯 CSS,交互由开发者控制。
// tachyons: 自行实现交互
document.querySelector('.btn').addEventListener('click', handler);
tailwindcss 纯 CSS,通常配合 Alpine.js 或框架使用。
// tailwindcss: 配合第三方库
document.querySelector('.bg-blue-500').addEventListener('click', () => {});
长期维护能力是架构选型的关键指标。
bootstrap 持续更新,社区庞大,插件丰富。
<!-- bootstrap: 生态丰富 -->
<!-- 大量第三方主题和组件可用 -->
bulma 稳定更新,社区活跃,扩展较多。
<!-- bulma: 扩展生态 -->
<!-- 有 bulma-extensions 等补充组件 -->
purecss 维护频率低,但非常稳定。
<!-- purecss: 稳定为主 -->
<!-- 适合不需要频繁变动的场景 -->
tachyons 更新放缓,社区重心转向 Tailwind。
<!-- tachyons: 维护模式 -->
<!-- 建议新项目评估替代方案 -->
tailwindcss 极度活跃,插件生态庞大,版本迭代快。
<!-- tailwindcss: 生态繁荣 -->
<!-- 拥有 @tailwindcss/forms, @tailwindcss/typography 等官方插件 -->
| 特性 | bootstrap | bulma | purecss | tachyons | tailwindcss |
|---|---|---|---|---|---|
| 类型 | 组件库 | 组件库 | 基础模块 | 效用类 | 效用类 |
| JS 依赖 | 可选 (v5 无 jQuery) | 无 | 无 | 无 | 无 |
| 定制方式 | Sass 变量 | Sass 变量 | CSS 覆盖 | 构建配置 | Config 文件 |
| 布局系统 | 行/列容器 | Flex 列 | 网格单元 | 功能类 | Flex/Grid 类 |
| 维护状态 | 活跃 | 活跃 | 稳定 | 低频 | 极度活跃 |
bootstrap 是快速交付的标准选择 🧰——适合需要现成组件且团队熟悉其模式的项目。如果项目依赖大量交互组件且不想重复造轮子,它是稳妥的方案。
bulma 是轻量级组件库的代表 🍃——适合喜欢其类名风格且希望保持 CSS 纯净的项目。如果你需要组件结构但不想要 JS 负担,选它。
purecss 是极简主义的选择 🪶——适合对体积敏感或只需基础样式的项目。不要指望它提供复杂组件,它只是基石。
tachyons 是效用类的先驱 🕰️——适合维护旧项目或偏好其特定设计系统的团队。新项目中,其生态活跃度不如 Tailwind。
tailwindcss 是现代开发的主流 🚀——适合需要高度定制、高性能构建和长期维护的项目。它的配置系统和生态工具链最完善。
最终建议:如果是新项目且追求灵活性和生态支持,优先选择 tailwindcss。如果需要快速搭建标准后台且减少样式编写,bootstrap 依然可靠。对于特定轻量需求,bulma 或 purecss 可作为备选。
选择 bootstrap 如果你需要一套完整的 UI 组件库(包括模态框、下拉菜单等),且希望减少自定义样式的工作量。它适合后台管理系统、原型开发或团队中设计资源有限的项目。注意 v5 版本已移除 jQuery 依赖。
选择 bulma 如果你偏好纯 CSS 方案,不希望引入额外的 JavaScript 捆绑包。它的类名可读性强,基于 Flexbox 构建,适合需要灵活布局但不需要复杂交互组件的项目。
选择 purecss 如果你追求极致的轻量级基础样式,只需要网格、按钮和表单等核心模块。它适合对性能敏感、希望手动控制大部分样式细节的老牌项目或嵌入式场景。
选择 tachyons 如果你喜欢功能型 CSS 理念但需要极小的运行时开销,且能接受较低的更新频率。它适合维护旧项目或偏好其特定命名风格的小型团队,新项目建议评估 tailwindcss。
选择 tailwindcss 如果你需要高度定制的设计系统,希望利用即时编译(JIT)优化构建体积。它是目前生态最活跃的效用类框架,适合现代 Web 应用、设计驱动型项目以及需要长期维护的大型系统。
Sleek, intuitive, and powerful front-end framework for faster and easier web development.
Explore Bootstrap docs »
Report bug
·
Request feature
·
Blog
Our default branch is for development of our Bootstrap 5 release. Head to the v4-dev branch to view the readme, documentation, and source code for Bootstrap 4.
Several quick start options are available:
git clone https://github.com/twbs/bootstrap.gitnpm install bootstrap@v5.3.8yarn add bootstrap@v5.3.8bun add bootstrap@v5.3.8composer require twbs/bootstrap:5.3.8Install-Package bootstrap Sass: Install-Package bootstrap.sassRead the Getting started page for information on the framework contents, templates, examples, and more.
Within the download you’ll find the following directories and files, logically grouping common assets and providing both compiled and minified variations.
bootstrap/
├── css/
│ ├── bootstrap-grid.css
│ ├── bootstrap-grid.css.map
│ ├── bootstrap-grid.min.css
│ ├── bootstrap-grid.min.css.map
│ ├── bootstrap-grid.rtl.css
│ ├── bootstrap-grid.rtl.css.map
│ ├── bootstrap-grid.rtl.min.css
│ ├── bootstrap-grid.rtl.min.css.map
│ ├── bootstrap-reboot.css
│ ├── bootstrap-reboot.css.map
│ ├── bootstrap-reboot.min.css
│ ├── bootstrap-reboot.min.css.map
│ ├── bootstrap-reboot.rtl.css
│ ├── bootstrap-reboot.rtl.css.map
│ ├── bootstrap-reboot.rtl.min.css
│ ├── bootstrap-reboot.rtl.min.css.map
│ ├── bootstrap-utilities.css
│ ├── bootstrap-utilities.css.map
│ ├── bootstrap-utilities.min.css
│ ├── bootstrap-utilities.min.css.map
│ ├── bootstrap-utilities.rtl.css
│ ├── bootstrap-utilities.rtl.css.map
│ ├── bootstrap-utilities.rtl.min.css
│ ├── bootstrap-utilities.rtl.min.css.map
│ ├── bootstrap.css
│ ├── bootstrap.css.map
│ ├── bootstrap.min.css
│ ├── bootstrap.min.css.map
│ ├── bootstrap.rtl.css
│ ├── bootstrap.rtl.css.map
│ ├── bootstrap.rtl.min.css
│ └── bootstrap.rtl.min.css.map
└── js/
├── bootstrap.bundle.js
├── bootstrap.bundle.js.map
├── bootstrap.bundle.min.js
├── bootstrap.bundle.min.js.map
├── bootstrap.esm.js
├── bootstrap.esm.js.map
├── bootstrap.esm.min.js
├── bootstrap.esm.min.js.map
├── bootstrap.js
├── bootstrap.js.map
├── bootstrap.min.js
└── bootstrap.min.js.map
We provide compiled CSS and JS (bootstrap.*), as well as compiled and minified CSS and JS (bootstrap.min.*). Source maps (bootstrap.*.map) are available for use with certain browsers’ developer tools. Bundled JS files (bootstrap.bundle.js and minified bootstrap.bundle.min.js) include Popper.
Have a bug or a feature request? Please first read the issue guidelines and search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issue.
Bootstrap’s documentation, included in this repo in the root directory, is built with Astro and publicly hosted on GitHub Pages at https://getbootstrap.com/. The docs may also be run locally.
Documentation search is powered by Algolia's DocSearch.
npm install to install the Node.js dependencies, including Astro (the site builder).npm run test (or a specific npm script) to rebuild distributed CSS and JavaScript files, as well as our docs assets./bootstrap directory, run npm run docs-serve in the command line.Learn more about using Astro by reading its documentation.
You can find all our previous releases docs on https://getbootstrap.com/docs/versions/.
Previous releases and their documentation are also available for download.
Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.
Moreover, if your pull request contains JavaScript patches or features, you must include relevant unit tests. All HTML and CSS should conform to the Code Guide, maintained by Mark Otto.
Editor preferences are available in the editor config for easy use in common text editors. Read more and download plugins at https://editorconfig.org/.
Get updates on Bootstrap’s development and chat with the project maintainers and community members.
irc.libera.chat server, in the #bootstrap channel.bootstrap-5).bootstrap on packages which modify or add to the functionality of Bootstrap when distributing through npm or similar delivery mechanisms for maximum discoverability.For transparency into our release cycle and in striving to maintain backward compatibility, Bootstrap is maintained under the Semantic Versioning guidelines. Sometimes we screw up, but we adhere to those rules whenever possible.
See the Releases section of our GitHub project for changelogs for each release version of Bootstrap. Release announcement posts on the official Bootstrap blog contain summaries of the most noteworthy changes made in each release.
Mark Otto
Jacob Thornton
Thanks to BrowserStack for providing the infrastructure that allows us to test in real browsers!
Thanks to Netlify for providing us with Deploy Previews!
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
Thank you to all our backers! 🙏 [Become a backer]
Code and documentation copyright 2011-2025 the Bootstrap Authors. Code released under the MIT License. Docs released under Creative Commons.