diff --git a/scss/_grid.scss b/scss/_grid.scss index 5b8b8cb236..d36ee75d88 100644 --- a/scss/_grid.scss +++ b/scss/_grid.scss @@ -21,9 +21,17 @@ } @include media-breakpoint-up($breakpoint, $grid-breakpoints) { - .container-#{$breakpoint} { + %responsive-container-#{$breakpoint} { max-width: $container-max-width; } + + @each $name, $width in $grid-breakpoints { + @if ($container-max-width > $width or $breakpoint == $name) { + .container#{breakpoint-infix($name, $grid-breakpoints)} { + @extend %responsive-container-#{$breakpoint}; + } + } + } } } } diff --git a/scss/_navbar.scss b/scss/_navbar.scss index 64c15f5347..f9e2b792a8 100644 --- a/scss/_navbar.scss +++ b/scss/_navbar.scss @@ -25,12 +25,23 @@ // Because flex properties aren't inherited, we need to redeclare these first // few properties so that content nested within behave properly. - > [class^="container"] { + %container-flex-properties { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; } + + .container, + .container-fluid { + @extend %container-flex-properties; + } + + @each $breakpoint, $container-max-width in $container-max-widths { + > .container#{breakpoint-infix($breakpoint, $container-max-widths)} { + @extend %container-flex-properties; + } + } } @@ -139,10 +150,21 @@ &#{$infix} { @include media-breakpoint-down($breakpoint) { - > [class^="container"] { + %container-navbar-expand-#{$breakpoint} { padding-right: 0; padding-left: 0; } + + > .container, + > .container-fluid { + @extend %container-navbar-expand-#{$breakpoint}; + } + + @each $size, $container-max-width in $container-max-widths { + > .container#{breakpoint-infix($size, $container-max-widths)} { + @extend %container-navbar-expand-#{$breakpoint}; + } + } } @include media-breakpoint-up($next) { @@ -163,10 +185,21 @@ } // For nesting containers, have to redeclare for alignment purposes - > [class^="container"] { + %container-nesting-#{$breakpoint} { flex-wrap: nowrap; } + > .container, + > .container-fluid { + @extend %container-nesting-#{$breakpoint}; + } + + @each $size, $container-max-width in $container-max-widths { + > .container#{breakpoint-infix($size, $container-max-widths)} { + @extend %container-nesting-#{$breakpoint}; + } + } + .navbar-collapse { display: flex !important; // stylelint-disable-line declaration-no-important diff --git a/site/content/docs/4.3/examples/grid/index.html b/site/content/docs/4.3/examples/grid/index.html index 24289cea52..1440cb7345 100644 --- a/site/content/docs/4.3/examples/grid/index.html +++ b/site/content/docs/4.3/examples/grid/index.html @@ -126,12 +126,14 @@ include_js: false -
-

Responsive containers

+
+

Containers

Additional classes added in Bootstrap v4.4 allow containers that are 100% wide until a particular breakpoint.

+
.container
.container-sm
.container-md
.container-lg
.container-xl
+
.container-fluid
diff --git a/site/content/docs/4.3/examples/navbars/index.html b/site/content/docs/4.3/examples/navbars/index.html index bdb4aeb019..3ec8bb9c73 100644 --- a/site/content/docs/4.3/examples/navbars/index.html +++ b/site/content/docs/4.3/examples/navbars/index.html @@ -220,6 +220,44 @@ extra_css:
+ + +
+ Matching .container-xl... +
+