Skip to content

css variables for breakpoints are missing in Bootstrap 5 #36094

@shaack

Description

@shaack

Prerequisites

Describe the issue

While BS 4 has the breakpoints like --breakpoint-sm: 576px; defined as css variables, these are missing in BS 5.

Although this should be present according to the documentation: "[...]we include our grid breakpoints as CSS variables (except for xs) [...]"

Quickfix (and main part of my pull request)

Add this to your scss

:root {
  @each $name, $value in $grid-breakpoints {
    --bs-breakpoint-#{$name}: #{$value};
  }
}

Reduced test cases

On top of /dist/css/bootstrap.css the css variables are defined. You can see that no variables are defined for the breakpoints.

What operating system(s) are you seeing the problem on?

All OS

What browser(s) are you seeing the problem on?

All Browsers

What version of Bootstrap are you using?

v5.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions