CSS for Woocommerce Category

Posted in: Newspaper
Post count: 12

Hi,
I’m using Newspaper 9.6.1, in combination with Woocommerce plug-in. I need to apply – to one category of Woocommerce – a different attribute; the size of the images showed in the category page must be 50% (ans only for this category). I tried in different ways with CSS but without success. Could you have look to the CSS that I used:

.woocommerce .category-<category-name>
ul.products li.product a img { width: 50%;}

Note that from the same page I removed the “read more” button applying this CSS that works fine.
.woocommerce ul.products li.product .button {
display: none;
}
Note that the site in under development and isnt’ in the net.
I’m stuck on this issue from two days and I need help.
Thx

Post count: 20688

Hi,

So the product images in a specific category should have half the width. I have a category “clothing” the page looks like this – http://prntscr.com/n7samw

To make that CSS apply only to the images in this category page, something like this would work – http://prntscr.com/n7sbuw

.woocommerce.term-clothing ul.products li.product a img{
width: 50%;
}

If that is indeed what you want to do, the code should do it, just change the “clothing” to the desired category name.

Thanks

Post count: 12

Many many thanks Simion. It works perfectly.
Thx fabio

Post count: 12

Hi, just another question, always related to woocommerce category image.
If I need to center the image in a certain category page where what is the correct CSS?
i tried with this but doesn’t work
.woocommerce.term-app-ios .aligncenter a img{}
Thx in advance/ Fabio
Note: that the “neighbour” images have the sime size

  • This reply was modified 7 years by fabaff. Reason: Additional info
Post count: 35449

Hi,

You can try this custom css
.woocommerce ul.products li.product a img {
margin-left: auto;
margin-right: auto;
text-align: center;
}

Also please check this documentation for Shortcodes included with WooCommerce -> https://docs.woocommerce.com/document/woocommerce-shortcodes/

Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.