mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
634344c003
* create responsive containers provide more flexibility and allow the user to determine when containers switch from fluid to fixed width. * fix the base container code this commit fixes the non-media portion of the generated CSS. I learned about the `@extends` directive and was able to put it to good use. I create a new temporary map that contains all the main `$container-max-widths` and join it to our 2 special cases of 'xs' and 'fluid'. Then we loop through that and, with the appropriate infixes, extend our placeholder * formatting for style forgot to run my tests before the last push, i think these are better. * finish incomplete comment * fix the responsive containers using the `@extend` directive I was able to clean up this code * fix responsive containers in the navbar mostly we just look through all of our breakpoints so we can include all of the responsive container classes in the tweaks we have to do for the navbar (redeclaring flex properties, don't double up on padding, etc) * Simplify container extends * Simplify navbar containers * Rearrange, add comments, ensure everything is nested in $enable-grid-classes * Reduce new CSS by using attribute selector We avoid using `@extend` whenever possible, and this is more readable * Update _grid.scss * Update _navbar.scss * Add docs for responsive containers, redesign the container layout page * Add to the Grid example
62 lines
1.3 KiB
SCSS
62 lines
1.3 KiB
SCSS
// Container widths
|
|
//
|
|
// Set the container width, and override it for fixed navbars in media queries.
|
|
|
|
@if $enable-grid-classes {
|
|
// Single container class with breakpoint max-widths
|
|
.container {
|
|
@include make-container();
|
|
@include make-container-max-widths();
|
|
}
|
|
|
|
// 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} {
|
|
@include make-container();
|
|
}
|
|
|
|
@include media-breakpoint-up($breakpoint, $grid-breakpoints) {
|
|
.container-#{$breakpoint} {
|
|
max-width: $container-max-width;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Row
|
|
//
|
|
// Rows contain and clear the floats of your columns.
|
|
|
|
@if $enable-grid-classes {
|
|
.row {
|
|
@include make-row();
|
|
}
|
|
|
|
// Remove the negative margin from default .row, then the horizontal padding
|
|
// from all immediate children columns (to prevent runaway style inheritance).
|
|
.no-gutters {
|
|
margin-right: 0;
|
|
margin-left: 0;
|
|
|
|
> .col,
|
|
> [class*="col-"] {
|
|
padding-right: 0;
|
|
padding-left: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Columns
|
|
//
|
|
// Common styles for small and large grid columns
|
|
|
|
@if $enable-grid-classes {
|
|
@include make-grid-columns();
|
|
}
|