首页 > 解决方案 > How to get value of grid-breakpoint variable

问题描述

I want to be able to access the value of each break point set in the $grid-breakpoints variable. It is laid out like this:

$grid-breakpoints: (
  xs: 0,
  sm: 576px,
  md: 768px,
  lg: 992px,
  xl: 1200px
);

In previous versions, the breakpoints were laid out like

$screen-md: 768px;

and so having something like width: $screen-md would produce width: 768px (or whatever the medium width is).

Now in BS4, I don't see how to do this. When I try using $grid-breakpoints as my variable - it breaks because the variable is pulling in all of those as one value.

Does that make sense what I'm trying to do? How can I do it?

标签: sassbootstrap-4

解决方案


像这样使用map-get

map-get($grid-breakpoints, "md")

演示:https ://www.codeply.com/go/31V8zhXAO5


推荐阅读