XF 2.2 How to display the article images/thumbnail as full and stretch not crop?

rdn

Well-known member
Not sure though what specific CSS I can use or change from this :|.
Code:
.message--articlePreview .articlePreview-image {
    background: center/cover #edf4fa no-repeat;
}
 
Changing that line to this will show the full image: background: center / contain #edf4fa no-repeat;.

However, there will be areas/gaps around the image due to forcing it into a space which it doesn't have native dimensions of.

Add this to the extra.less template:
Less:
.message--articlePreview .articlePreview-image
{
    background-size: contain;
}

1616087490535.png

1616087502560.png
 
  • Love
Reactions: rdn
With background-size I think it's not possible to specify background color also, so I use:
Code:
.message--articlePreview .articlePreview-image {
    background: center / contain @xf-paletteNeutral3 no-repeat;
}
 
Top Bottom