Can I add color to the text in post titles?

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?
image

as shown in the image:
image

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
    }
1 Like

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
    }

Here:

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?

Also, how can I find the ID of a post? Is it the number at the end of each post?
image

1 Like

I don’t know why it’s not working. Is my code written correctly?

Obtained ID:
image

After refreshing the browser, the specified theme color for the ID remains unchanged.

Does it work when you use the preview button?

Hello, I tested the preview and the pop-up page still didn’t see the specified ID’s theme color change.

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.

This is quite handy as you could color title via cat/sub or 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


Create a theme component and add it using this:

2 Likes

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.

Then try adding the !important flag

tr[data-topic-id="51"] td.topic-list-data .title {
    color: red !important;
}
2 Likes

Wow! Instantly effective, you’re amazing!
Wow! It works instantly, you’re amazing!

Is it because the priority is not enough?

1 Like

Yes, I’m too lazy to see where the CSS has taken effect.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.