sass – 如何在Bootstrap中引用$container-max-widths

前端之家收集整理的这篇文章主要介绍了sass – 如何在Bootstrap中引用$container-max-widths前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我目前正在使用Bootstrap 4,我对断点做了一些更改 – 看起来像这样:

$container-max-widths: (
    xs: 540px,sm: 700px,md: 960px,lg: 1140px,xl: 1300px,g: 1560px,xg: 1920px
) !default;

这是我的问题:我如何参考$container-max-widths – > g从中得到1560px?

我想做这样的事情,但它不起作用:

max-width: $grid-breakpoints('g');

任何想法,如果可能的话?

解决方法

您可以创建一个函数来检索断点值,如下所示:

@function get-breakpoints($key: "md") {
    @return map-get($container-max-widths,$key);
}

.test-class {
    max-width: get-breakpoints("g");
}

猜你在找的Bootstrap相关文章