Skip to content

Instantly share code, notes, and snippets.

@dannyfoo
Last active April 27, 2022 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannyfoo/740faea65ed649c1a0c6ddede4eb310f to your computer and use it in GitHub Desktop.
Save dannyfoo/740faea65ed649c1a0c6ddede4eb310f to your computer and use it in GitHub Desktop.
Elementor snippets
/**
* Force the feature image to occupy post image space in Cards layout
* Choose 1 of the solutions below which suits your scenario
**/
/* if the elementor-fit-height class exists */
.elementor-post__thumbnail.elementor-fit-height img {
height: 100% !important;
width: auto !important;
}
/* target all the elementor-post__thumbnail class */
.elementor-post__thumbnail.elementor-fit-height img {
height: 100% !important;
object-fit: cover;
}
/**
* Force the images in carousel to fit based on available width regardless of their height
* This is when image size uses default sizes (e.g. Large, Medium etc)
**/
.elementor-image-carousel .swiper-slide {
height: auto; /* makes the container use the image height as a reference */
}
.elementor-image-carousel .swiper-slide figure,
.elementor-image-carousel .swiper-slide img {
height: 100%; /* forces the figure and img to fill the height of the container */
object-fit: cover; /* forces the img to fill based on the container height */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment