Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #107887
    lucapizzonia
    Participant

    Hi,
    is it possible set an image background in the rectangle where appear “Category: xxxx”? I have four different post categories and I would show an image (or a different color) to identify single category.
    Thanks

    #107891
    Mahesh
    Keymaster

    @lucapizzonia: Please post in your site url.

    Regards,
    Mahesh

    #107927
    lucapizzonia
    Participant
    #107970
    Mahesh
    Keymaster

    @lucapizzonia: You can do this with Custom CSS. Go to Dashboard=> Appearance=> Customize=> Additional CSS box and add the following CSS:

    .category-172 .page-header .page-title {
    	background-color: #00ff00;
    }
      
    .category-170 .page-header .page-title {
    	background-color: #ff00ff;
    }

    Note: I used background-color instead of images.

    Regards,
    Mahesh

    #107974
    lucapizzonia
    Participant

    Can I use:
    background: url(pathofimagefile);
    to insert an image as an alternative to color?
    Is synthax correct?

    #107992
    Mahesh
    Keymaster

    @lucapizzonia: Please use the following:

    .category-170 .page-header .page-title {
        background-image: url("pathofimagefile");
    }

    Regards,
    Mahesh

    #108024
    lucapizzonia
    Participant

    Thanks you Mahesh,
    your code shows image. But there’s a little problem (last I hope): on my notebook image is complete, on other pc (with lcd 17″ 4:3) image is cutted, as same on smartphone.
    Is there a css command to make image auto resizing?

    #108063
    Mahesh
    Keymaster

    @lucapizzonia: Please replace the above CSS with the following:

    .category-172 .page-header .page-title {
        background-image: url("http://www.lucapizzonia.com/wordpress/wp-content/uploads/2017/01/Space-Invaders.png");
        background-position: center top;
        background-size: cover;
    }

    Regards,
    Mahesh

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Category label: change color or set image background’ is closed to new replies.