简体   繁体   English

扩展Bootstrap 4和SASS

[英]Extending Bootstrap 4 and SASS

As Bootstrap was only recently officially released some of the pages still need to be worked on ( https://getbootstrap.com/docs/4.0/extend/ - todo: this entire page ). 由于Bootstrap最近才正式发布,因此仍需要处理一些页面( https://getbootstrap.com/docs/4.0/extend/ - todo:整个页面 )。

I'm entirely new to sass/scss so this might be easy. 我对sass / scss完全不熟悉所以这可能很容易。 What I want to do is create an entire class that works with all the pre-configured styles in bootstrap. 我想要做的是创建一个完整的类,它与bootstrap中的所有预配置样式一起使用。

For example, how could I make a .drop-shadow class, that would implement all the colors (and eventually other settings) like .drop-shadow-primary , .drop-shadow-secondary and so on. 例如,我怎样才能创建一个.drop-shadow类,它将实现所有颜色(以及最终的其他设置),如.drop-shadow-primary。drop-shadow-secondary等。

It could be done by iterating the Bootstrap 4 theme-colors() map like this... 可以通过迭代这样的Bootstrap 4 theme-colors()映射来完成...

@each $color, $value in $theme-colors {
  .drop-shadow-#{$color} {
    box-shadow: 3px 3px 3px $value;
  }
}

https://www.codeply.com/go/LyLcAK9oHN https://www.codeply.com/go/LyLcAK9oHN

Also see: How to change the bootstrap primary color? 另请参阅: 如何更改引导原色?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM