Hello everyone, I have a question: When creating a new post, is it possible to add color to the text in the title, as shown in the picture?
as shown in the image:
用户 shawa 提问如何在帖子标题中添加颜色,Lhc_fl 解释可通过 CSS 为特定主题 ID 设置颜色,例如使用 tr[data-topic-id="314580"] td.topic-list-data .title { color: red }。shawa 询问具体操作和代码位置,Lhc_fl 指出需在主题的自定义 CSS/HTML 中添加代码,并建议使用 !important 提高优先级以确保生效 Lhc_fl。shawa 发现仅默认主题支持此功能,其他主题需创建主题组件并包含在启用的主题中。最终,添加 !important 后颜色生效,shawa 表示感谢。
It’s possible to do in CSS with the attributes of topic’s “tr” tag. It has topic id, category & tag slugs, topic statuses, etc.
![]()
How should I specifically operate? Are there any detailed tutorials?
@Lhc_fl 大佬,帮我看看
Esteemed colleague, might I trouble you to cast your discerning eye over this matter?
I need you to give more detailed information
Specifically, you did not explain the rules for coloring different topics with different colors.
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
}
Hello, I tested the preview and the pop-up page still didn’t see the specified ID’s theme color change.
This is quite handy as you could color title via cat/sub or tag.
Then try adding the !important flag
tr[data-topic-id="51"] td.topic-list-data .title {
color: red !important;
}
Wow! Instantly effective, you’re amazing!
Wow! It works instantly, you’re amazing!
Is it because the priority is not enough?
Yes, I’m too lazy to see where the CSS has taken effect.