大家好,我有一个问题:在创建新帖子时,是否可以在标题中为文本添加颜色,如下图所示?
如下图所示:
可以使用 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
}
我看了下,我这边只有停用的主题里有这个自定义 CSS/HTML选项,就是在这里设置吗?
I took a look, and the only theme with the custom CSS/HTML option deactivated is mine. Is this where I can set it up?
另外请问帖子的ID怎么查询,是每个帖子末尾的数字吗?
Also, how can I find the ID of a post? Is it the number at the end of each post?
![]()
不知道为什么没用生效,我的代码这样写正确吗?
I don’t know why it’s not working. Is my code written correctly?
获取到的ID:
Obtained ID:

浏览器刷新后指定ID的主题颜色没有任何变化
After refreshing the browser, the specified theme color for the ID remains unchanged.
你好,我测试了预览,弹出页面仍然没有看到指定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 为标题着色。
因为那几个主题都是你安装的别人预先写好的,无法修改
Because those themes you installed were pre-written by others and cannot be modified
解决方式就是尝试创建一个主题组件,然后包含在你启用的主题内
The solution is to try to create a theme component and then include it in your enabled theme
Hello, I tried creating a new theme test. However, whether it is previewing the theme or switching to this theme, the title color of the corresponding ID still has not changed at all. I don’t know where else I need to make adjustments.
你好,我尝试新建了一个主题测试,无论是主题预览还是切换到这个主题,对应ID的标题颜色还是没有任何变化,不知道哪里还需要调整下

那你试试加上 !important 标记
tr[data-topic-id="51"] td.topic-list-data .title {
color: red !important;
}
Wow! Instantly effective, you’re amazing!
哇! 瞬间生效, 你太棒了!
是优先级不够吗
是,我懒得看具体在哪里生效了什么css
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.