Category Boxes Image Alignment Issue

Hi, I am using Air Theme, which looks awesome!

I have set my categories as boxes. When I upload an image 200 x 200px it does not fit nicely. I am not sure what css I would need to make it look like the box on the right but with my image. So the colour goes to the edges the same way the one on the right does.

Just an update. This is what it says on the upload screen - Recommended 1:1 aspect ratio with 200px minimum size. If left blank no image will be shown. - I have also made it 1000 x 1000 and there is no change, so I think this might be an issue with the way the theme is working. Apart from it not displaying the image to the edges of the box, it also shows a part of the previous blue background behind my image.

Any thoughts or ideas?

Hi there – is this on your hosted trial? If so, you will not be able to edit the CSS on our Starter plan, I’m afraid.

1 Like

Hi Hawk,

Thanks for your reply.

No I am on a fresh self hosted install with Air Theme. I kind of think there is an issue with the theme with aligning the images correctly. All I did was upload my file in the recommended ratio and the displayed result is as you see it above.

It would be nice if the image was displayed all the way to the edges as it does in the placeholder before uploading images. If not at the very least not have the blue remnants of the placeholder visable behind my image.

I’m happy to put CSS code somewhere to fix it, though I am not sure where and what code I need to put in there. Though as I said I think it might be something going on with the theme not displaying the uploaded file correctly.

There’s a margin-top: .5em on the parent div, which shifts the parent and the child image down.

You can try overriding this behavior:

 categories-list .category .category-logo.aspect-image {
    margin-top: 0;
}

I think this issue should have an official fix, though.

2 Likes

Hi Coin-coin le Canapin,

Thank you for the css code. I am not really sure where to add this. I did search online and I think I need to add it as a component to the air theme. Which I did and when enabled it does not make any change. I am probably doing it wrong.

I agree I think this needs to be looked at on the theme. I might make a post on the theme page and see if it can be fixed.

Hi Hawk,
Is there a way I can tag someone from the Air Theme team on this post to try and get a resolution to this issue.

I did try the css that was mentioned by another user in this post but it did not seem to work.

Cheers
Bec

Hi Bec, I have assigned a designer to take a look but I can’t give you a timeframe sorry, it’s the weekend.

1 Like

No worries. Thank you very much.

1 Like

Hey there! Thanks for reporting this. I will take a look and get you an answer soon, or add the fix to the theme.

1 Like

I have a fix here → DEV: fix image size by jordanvidrine · Pull Request #49 · discourse/discourse-minimal-category-boxes · GitHub

If you update the modern category boxes theme component installed onto the air theme, it should fix your issue.

Thanks!

4 Likes

Hi Jordan,

Thank you very much. Yes that has fixed the issue with still seeing the placeholder in the background.

I wonder if you can tell me how I can make my image go to the edges of the box like the place holder does. It looks much nicer and I was expecting it would look the same when I uploaded my image.

If there is CSS I need to use where would it go as CSS I tried to add before didn’t seem to work and I’m not sure if this is because changes are not allowed on the theme or if I just don’t know what I am doing as I am new to discourse.

Cheers
Bec

Hi Jordan,
I just wanted to update you.

A strange thing happened when I edited the 3rd category box suddenly all the images snapped into place by themselves. So all looking ok now.

Thanks again for all of your help.

Hi again Jordan,

Actually it is going to be an issue if you have categories that have less than 3 in a row. When the 3rd image in a row is added it all snaps nicely into place as in my previous message. But if you have only two in a row then it doesn’t place the image nicely within the box it puts it in as a square. So now I have some images that look nice and some that have a square image.

1 Like