CMS Development

SMushnick
Membre

Image size for blog page sidebar

Résolue

Hi, currently, the sizes of images on the blog sidebar are not all the same size (see screenshot attached). I have various different things but nothing seems to be working. Is there a specific code I need to enter into the template css? Please help!Screen Shot 2022-06-10 at 11.34.55 AM.png

0 Votes
1 Solution acceptée
Indra
Solution
Guide | Partenaire solutions Elite
Guide | Partenaire solutions Elite

Image size for blog page sidebar

Résolue

Hi @SMushnick,

 

If you want to force the image size you can use the css options aspect-ratio. This is fully supported for most browsers.

 

If you use aspect ratio, I recommend to use object-fit cover if it's an image (img) object.

 

So your css should be like this:

.featured-image{
  aspect-ratio: 16/9;
  object-fit: cover;
}

 


Indra Pinsel - Front-end developer - Bright Digital
Did my answer solve your issue? Help the community by marking it as the solution.

Voir la solution dans l'envoi d'origine

1 Réponse
Indra
Solution
Guide | Partenaire solutions Elite
Guide | Partenaire solutions Elite

Image size for blog page sidebar

Résolue

Hi @SMushnick,

 

If you want to force the image size you can use the css options aspect-ratio. This is fully supported for most browsers.

 

If you use aspect ratio, I recommend to use object-fit cover if it's an image (img) object.

 

So your css should be like this:

.featured-image{
  aspect-ratio: 16/9;
  object-fit: cover;
}

 


Indra Pinsel - Front-end developer - Bright Digital
Did my answer solve your issue? Help the community by marking it as the solution.