Bootstrap5 断点使用
Bootstrap 内置了 6 个默认断点,有时也被叫做 grid tiers, for building responsively. 如果你使用的是 Bootstrap 的 Sass 源文件,则可以自定义这些断点。
| Breakpoint | Class infix | Dimensions |
|---|---|---|
| Extra small | None | <576px |
| Small | sm |
≥576px |
| Medium | md |
≥768px |
| Large | lg |
≥992px |
| Extra large | xl |
≥1200px |
| Extra extra large | xxl |
≥1400px |
Each breakpoint was chosen to comfortably hold containers whose widths are multiples of 12. Breakpoints are also representative of a subset of common device sizes and viewport dimensions—they don’t specifically target every use case or device. Instead, the ranges provide a strong and consistent foundation to build on for nearly any device.
这些断点可以通过 Sass 变量来自定义(你可以在 _variables.scss 文件中找到它们)。
$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px,
xxl: 1400px
);
