如何在不使用mixin的情况下重用sass中的类? [英] How to reuse a class in sass without using a mixin?

查看:59
本文介绍了如何在不使用mixin的情况下重用sass中的类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的应用程序中的所有锚点都看起来像.btn(Twitter Bootstrap类),有没有办法做到这一点?

I want all my anchors in my application look like .btn (Twitter Bootstrap class), is there a way to make this?

我做到了

a{
  @include btn;
}

但是它不起作用,因为btn应该是一个mixin,它是一个Twitter Bootstrap类.

but it does not work because btn should be a mixin, and it's a Twitter Bootstrap class.

推荐答案

您要使用@extend .btn;-@extend允许您继承选择器的所有属性,而不必将其定义为mixin.

You want to use @extend .btn; - @extend allows you to inherit all the properties of a selector without having to define it as a mixin.

这篇关于如何在不使用mixin的情况下重用sass中的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆