• Resolved nasciii

    (@nasciii)


    Hello, I would like the background of my single product page to be colored. In this case, a color for each product category.

    Example: Electronics, single product with blue background
    Automotive, red and etc …

    • This topic was modified 5 years, 3 months ago by nasciii.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Please post the address of your site.

    Thread Starter nasciii

    (@nasciii)

    Hello my friend. My site is still on localhost but I will post an image.

    In the example, the color red applies to this product category: Tv Box1. Using the code

    /* .et-product-detail .product-showcase {
    background-color: tomato; */

    but that code applies color in all categories. I would like to specify the category for the color target.

    Image: https://ibb.co/1sFzCGs

    The image doesn’t help. I wanted to examine the classes in the body tag with browser tools. I should expect to find the category amongst the classes. For example, on my site, for the mobile phone category, I would use:

    .term-mobile-phones {
      background-color: tomato;
    }
    Thread Starter nasciii

    (@nasciii)

    I understand, I will return when he is online.

    But his code worked, but he applied the category page. I would like to apply the color only to the background of the product page.

    Anyway, thanks for the help.

    The same technique applies to product pages. For a particular product, by body classes include postid-7307 where 7307 is the id of the product. Your site may be slightly different. So I would write:

    .postid-7307 {
      background-color: tomato;
    }

    You can’t directly target all the products in a category. This is because products may be in one or several categories. The product category is not one of the classes for a product page. You would need to write a style for each product page individually.

    Thread Starter nasciii

    (@nasciii)

    That’s it! Thank you very much!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Single product background page’ is closed to new replies.