Center td.posters container

AI-generated summary

Centering td.posters Container

Original poster davidkingham is seeking CSS assistance to center the td.posters container. They have modified code to increase the avatar size of the original poster, but are struggling to center the container.

After three years, davidkingham still hasn’t found a solution and has had others review the code without success.

Canapin suggests removing display: flex from .td.posters to vertically center the avatars. However, this requires adjusting the width of .topic-list .posters.theme-avatar-medium to 187px and adding a margin-top to the first avatar to align it with the others.

Canapin provides an example of the updated CSS:

.topic-list .posters>a:first-child {
    margin-top: -4px;
}

I could use a little css/flex assistance. I have been working on making the avatar of the original poster larger than the rest of the avatars and have figured everything out except how to center td.posters

I have used the method described here https://meta.discourse.org/t/how-to-increase-avatars-size-on-latest-without-making-them-blurred/89606 and modified it work with the original rather than latest. Here is my css:

td > a:first-child > img:first-child {
    height: 50px;
    width: 50px;
    margin-right: 3px;
}
  
td.posters {
    display: flex;
    align-items: center;
    margin-right: 25px;

  img.avatar {
    height: 25px;
    width: 25px;
  }
}

.topic-list .posters a:first-child .avatar.latest:not(.single) {
    top: 1px;
    bottom: 1px;
}

.topic-list td.posters {
        height: 54px;
}

Below I marked what I want to be centered between the dashed arrows. Here’s a link to my site.

I tried increasing the height of td.containers, but that only works on categories where I’m using the topic previews, in other categories where that is turned off it makes the spacing too large. I could target those categories to reduce the height but would prefer not to if there is an easier way. Thanks!

You may wish to hire someone experienced with CSS to assist you?

Still haven’t found a solution to this 3 years later :laughing: Had someone else look at it but they couldn’t figure it out eithier :man_shrugging:

With a display: flex on the <td>, I’m not sure this is possible without adding a bit of HTML :thinking:

If you remove the display: flex from .td.posters, it will vertically center the avatars, regardless of the row height.

However, the cell containing the avatars .topic-list .posters.theme-avatar-medium, which has a fixed width, is a bit too short (176px) and the last avatar will go to a new line. If you increase it to 187px, it seems to fit.

Then, the avatars won’t be exactly at the same height because the first one is larger, which can be solved by:

.topic-list .posters>a:first-child {
    margin-top: -4px;
}