Skip to content

Commit

Permalink
New $grid-breakpoint-max-offset Sass variable
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-deramond committed Jan 30, 2025
1 parent 5708adc commit be76463
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ $paragraph-margin-bottom: 1rem !default;
// Define the minimum dimensions at which your layout will change,
// adapting to different screen sizes, for use in media queries.

$grid-breakpoint-max-offset: .02 !default;

// scss-docs-start grid-breakpoints
$grid-breakpoints: (
xs: 0,
Expand Down
7 changes: 4 additions & 3 deletions scss/mixins/_breakpoints.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
}

// Maximum breakpoint width.
// The maximum value is reduced by 0.02px to work around the limitations of
// `min-` and `max-` prefixes and viewports with fractional widths.
// The maximum value is reduced by `$grid-breakpoint-max-offset` (0.02px)
// to work around the limitations of `min-` and `max-` prefixes and viewports
// with fractional widths.
// See https://www.w3.org/TR/mediaqueries-4/#mq-min-max
// Uses 0.02px rather than 0.01px to work around a current rounding bug in Safari.
// See https://bugs.webkit.org/show_bug.cgi?id=178261
Expand All @@ -42,7 +43,7 @@
// 767.98px
@function breakpoint-max($name, $breakpoints: $grid-breakpoints) {
$max: map-get($breakpoints, $name);
@return if($max and $max > 0, $max - .02, null);
@return if($max and $max > 0, $max - $grid-breakpoint-max-offset, null);
}

// Returns a blank string if smallest breakpoint, otherwise returns the name with a dash in front.
Expand Down

0 comments on commit be76463

Please sign in to comment.