.mixin > 的 LESS 语法*

发布于 2025-01-03 20:43:26 字数 398 浏览 8 评论 0原文

我正在使用 LESS,并且正在尝试一种 mixin。

我有这个 mixin:

.mixin, .mixin > * {
    font:arial;
}

我想将它用作 so 中的混合。

.my-class {
    color:#000;
    .mixin;
}

变成

.my-class {
    color:#000;
}

.my-class, .my-class > * {
    font:arial;
}

但它不起作用,可能是因为我不能像那样使用 mixin。或者我可以吗?那我该怎么写呢?在 LESS 的文档中找不到此信息。

I am using LESS and im trying for a type of mixin.

I have this mixin:

.mixin, .mixin > * {
    font:arial;
}

and i want to use it as a mix in so.

.my-class {
    color:#000;
    .mixin;
}

becomes

.my-class {
    color:#000;
}

.my-class, .my-class > * {
    font:arial;
}

But it doesnt work, probobly because i cannot use mixins like that. Or can I? How do i write them then? Cannot find this information in the documentation of LESS.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小清晰的声音 2025-01-10 20:43:26

怎么样:

.amixin {
    font: Arial;
}

.mixin, .mixin > * {
    .amixin;
}

.my-class {
    color: #000;
    .amixin;
}

How about:

.amixin {
    font: Arial;
}

.mixin, .mixin > * {
    .amixin;
}

.my-class {
    color: #000;
    .amixin;
}
罪#恶を代价 2025-01-10 20:43:26

答案是这样的。

.mixin {
    font:arial;

    > * {
        font:arial;
    }
}

.my-class {
    color:#000;
    .mixin;   
}

The answer was this.

.mixin {
    font:arial;

    > * {
        font:arial;
    }
}

.my-class {
    color:#000;
    .mixin;   
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文