How can I change the background of a certain topic?

Продолжая обсуждение из темы Background of topic color change:

Hello, how can I change the background of a certain topic?

1 Like

Or. I can’t code. What would be the css code to customize the background of topics of a specific subcategory?

Thank you for your reply!

1 Like
.category-support .topic-post {
    background: red;
}

does:

The category-specific class is found in the <body> tag.


If you want to highlight only the first post:

.category-support .topic-post:first-child {
    background: red;
}

If you want to change the background of category-specific topics in a topic list, then the topic you linked is the way to do it.

.category-support.topic-list-item {
    background: red;
}

does:

3 Likes

Big thanks to you :+1:
I will definitely try!

Can I add an image instead of a color?

Another question: what is the code to customize the background of a certain subcategory?
Thank you

Hello,

You can also use the category settings to set up background image to category.

1 Like

Yes, it worked :+1:. But when I make the page public the background stays white :point_down:

The functionality of the public page is very limited.
For example, the YouTube video preview is not shown (only the video banner is shown). You cannot make an image carousel (all images are placed one after another down the page).
From here, I have the following questions: Is it possible to improve the function of the public page on my own, or are there already ready-made codes for improving the public page?
Maybe I should create a separate post on this issue :thinking:

You would need to style the published page separately from the topic itself, but every published page has its own ID so it is possible to tweak them with some CSS. eg:

.published-page {
  &.testing-published-page.topic-276.foo {  /*this is my page ID which is composed of topic-title+topic-ID+category-slug*/
    background-color: #c4ddc4;

    .published-page-header {
      background-color: #facccc;
    }

    blockquote {
      background-color: #facccc;
      border: 5px solid #fb7878;
    }
  }
1 Like

Thanks, I really appreciate your answer.
Is it possible to make the code so that the published page automatically inherits the design of the original post?

Thanks for your reply!
I remembered this feature. This function sets the background for all topics in a particular category. Can I code the background in the post editor, only for a specific post. Without customizing the background of the entire section

Can you show me an approximate, more specific text, how it is written, otherwise I can’t?

topic-title = kody-css-dlya-nastrojki-oformleniya-temy
category slug = staff
topic id = image

Here is my published page :point_down:

Have you looked up the details for the page in your browser inspector?

no, because I don’t understand it.
you mean something like this :point_down:?

I took the id from the browser :point_up_2:
image

I’m afraid my CSS skills are still limited to just snippets and tweaks, so I’m not the best person to teach even the basics. :slightly_smiling_face:

We do have a few guides that may be useful?

1 Like

Can I have one more question, I’m afraid no one else will answer me except you. How to make a similar flicker (flare) of the button?
Button-whatsapp gif

Here is my button code

[data-theme-button2] {
    display: flex;
    justify-content: end;
    a {
        padding: 10px 50px;
        background: #24E927;
        border-radius: 5px;
        border: 1px solid #004E7D;
        color: #004E7D;
        font-weight: 600;
    }
}

You can get Discourse-specific help here, but you’ll need to go elsewhere to get css tricks . I just use Google and https://css-tricks.com/

4 Likes

Hello. Thanks for the info :raised_hands:
I think it’s better for me to hire a specialist than to understand coding. Мне нужно было решить вопрос с кодом кнопки. At this time, I needed to solve the issue with the button code.

2 Likes

If you need to hire someone regarding css modifications or a bit more, you can post in #marketplace and/or send me a personal message.

2 Likes