# 如何更改没有选择器的 span 元素的文本？

**URL:** <https://meta.discourse.org/t/how-to-change-text-of-this-span-object-with-no-selectors/272016>\
**Category:** Development\
**Created:** [2023年七月18日 19:46 UTC](https://meta.discourse.org/t/how-to-change-text-of-this-span-object-with-no-selectors/272016 "2023-07-18T19:46:52Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2023年七月19日 07:53 UTC](https://meta.discourse.org/t/how-to-change-text-of-this-span-object-with-no-selectors/272016/6 "2023-07-19T07:53:02Z")

</div>

> [@jordan-violet](#):
>
> 按类别进行。

如果你想在多个类别中执行此操作并避免出现大量 SCSS 行，可以使用 SCSS 循环。它使代码更易于阅读和维护，因为你只需编辑两个 SCSS 变量。

> [@How to add unique text below each category image?](https://meta.discourse.org/t/how-to-add-unique-text-below-each-category-image/265792/6?u=canapin):
>
> Oh, I see. slight_smile You can still use a pure SCSS solution using category slugs: information_source If you want to add line breaks in the text, put \A inside your text, and add white-space: pre; in the :after pseudo element properties. $categories: "nature", "general"; $labels: "All natural!\ANaturaaal!" "Another text"; @each $category, $label in zip($categories, $labels) { body.category-#{$category} .category-heading .category-logo.aspect-image { max-height: none; &:after …

---

_[View the full topic](https://meta.discourse.org/t/how-to-change-text-of-this-span-object-with-no-selectors/272016)._
