0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-28 00:54:30 +01:00
Bootstrap/scss/layout/_containers.scss
Mark Otto 3d1dd436da
All checks were successful
BrowserStack / browserstack (push) Has been skipped
Breakpoints update
- Rename $grid-breakpoints to $breakpoints
- Rename -xxl to -2xl
- Update docs to use new classes
- Update breakpoints docs to add new language around updated breakpoint mixins and media queries, including no longer needing -.02px
2025-02-25 08:55:23 -08:00

58 lines
1.6 KiB
SCSS

@use "../config" as *;
@use "breakpoints" as *;
// Container widths
//
// Set the container width, and override it for fixed navbars in media queries.
// Container mixins
@mixin make-container($gutter: $container-padding-x) {
--#{$prefix}gutter-x: #{$gutter};
--#{$prefix}gutter-y: 0;
width: 100%;
padding-right: calc(var(--#{$prefix}gutter-x) * .5);
padding-left: calc(var(--#{$prefix}gutter-x) * .5);
margin-right: auto;
margin-left: auto;
}
@layer layout {
@if $enable-container-classes {
// Single container class with breakpoint max-widths
.container,
// 100% wide container at all breakpoints
.container-fluid {
@include make-container();
}
// Responsive containers that are 100% wide until a breakpoint
@each $breakpoint, $container-max-width in $container-max-widths {
.container-#{$breakpoint} {
@extend .container-fluid;
}
@include media-breakpoint-up($breakpoint, $breakpoints) {
%responsive-container-#{$breakpoint} {
max-width: $container-max-width;
}
// Extend each breakpoint which is smaller or equal to the current breakpoint
$extend-breakpoint: true;
@each $name, $width in $breakpoints {
@if ($extend-breakpoint) {
.container#{breakpoint-infix($name, $breakpoints)} {
@extend %responsive-container-#{$breakpoint};
}
// Once the current breakpoint is reached, stop extending
@if ($breakpoint == $name) {
$extend-breakpoint: false;
}
}
}
}
}
}
}