首页 > 解决方案 > Bootstrap,scss,在scss代码中使用一些类名,而不是写在html文件中

问题描述

在 Bootstrap 4 中,我可以将text-truncate其用作元素中的类。例如:

<span class="text-truncate">Any very long text</span>

我现在需要的是text-truncate在一个 scss 文件中为许多对象使用这个类,而不是直接在 .html 文件中编写它。

如何?

我可以使用类似的东西:

@import "text-truncate" from "bootstrap.scss";

.myBeautifulDiv {
  use text-truncate;
}

这会很棒!可能吗?

标签: csstwitter-bootstrapsassbootstrap-4scss-mixins

解决方案


完全有可能。去这里(https://getbootstrap.com/docs/4.1/getting-started/download/),点击“下载源代码”,你要找的可能在_scss文件夹中。


推荐阅读