gpt4 book ai didi

css - 如何从 Bootstrap 功能在 css 中创建一个新类

转载 作者:太空宇宙 更新时间:2023-11-04 15:22:28 27 4
gpt4 key购买 nike

我正在努力将 bootstrap css 从我的代码中移出。

我想构建可以从我的 .css(实际上是 .scss)文件调用的各种类。

CSS 和我一直走过不同的道路,但我现在才刚刚开始学习它。

我想在不同的 css 类中构建这样的东西:-

<div class="well span4">  

CSS

.datainput {  
well; span4 #<<<<this is where I get lost.
}

谢谢

最佳答案

在 Sass 中,类是这样扩展的:

.datainput {
@extend .well;
@extend .span4;
}

这将生成如下所示的输出:

.well, .datainput {
// styles here
}

.span4, .datainput {
// styles here
}

如果您使用的是 LESS,这是 TB 编写的,它看起来像这样:

.datainput {
.well;
.span4;
}

关于css - 如何从 Bootstrap 功能在 css 中创建一个新类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14420905/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com