大家好,我有一个问题:在创建新帖子时,是否可以在标题中为文本添加颜色,如下图所示?
如下图所示:
可以使用 CSS 和主题的 “tr” 标签的属性来实现。它具有主题 ID、类别和标签的 slug、主题状态等。
![]()
我应该如何具体操作?有详细的教程吗?
@Lhc_fl 大佬,帮我看看
尊敬的同事,能否请您拨冗审阅此事?
我需要你给出更详细的信息
I need you to give more detailed information
具体来说,要以什么规则给不同的话题染上不同的颜色,你没有说明,
Specifically, you did not explain the rules for coloring different topics with different colors.
比如这样写可以让id为314580的帖子染上红色
For example, this will make the topic with id 314580 red.

tr[data-topic-id="314580"] td.topic-list-data .title {
color: red
}
感谢回复,请问这段代码要在哪里添加或设置?
Thank you for your response. I wonder, where should this code be added or configured?
tr[data-topic-id="314580"] td.topic-list-data .title {
color: red
}
你好,我测试了预览,弹出页面仍然没有看到指定ID的主题颜色变化。
我发现只有默认主题才有这个“编辑 CSS/HTML”选项,其他添加的主题没有这个选项,不过我即便启用这个默认主题,我修改过的标题颜色还是没有变化,不知道哪里步骤错了。
I found that only the default theme has the “Edit CSS/HTML” option, other added themes do not have this option. However, even if I enable the default theme, the color of the title I modified still does not change. I’m not sure where I went wrong in the process.
这非常方便,因为您可以通过 cat/sub 或 tag 为标题着色。
那你试试加上 !important 标记
tr[data-topic-id="51"] td.topic-list-data .title {
color: red !important;
}
Wow! Instantly effective, you’re amazing!
哇! 瞬间生效, 你太棒了!
是优先级不够吗
是,我懒得看具体在哪里生效了什么css