How to change the aspect-ratio in the Image element

As there is no option to change the aspect-ratio of the image element in Breakdance (at least for the moment), we have to do it manually, with some custom CSS.

supamike_professional_photo_of_futuristic_time_travelling_car_a_f0bf88e9-57dc-489b-b4d0-6e3fed1b4ef9
original image
supamike_professional_photo_of_futuristic_time_travelling_car_a_f0bf88e9-57dc-489b-b4d0-6e3fed1b4ef9
aspect-ratio:1
supamike_professional_photo_of_futuristic_time_travelling_car_a_f0bf88e9-57dc-489b-b4d0-6e3fed1b4ef9
aspect-ratio:16/9

Step 1

Select the Image element, set the Height to auto , and Object Fit to Cover

image-aspect-ratio-options

Step 2

In the Advanced tab of the Image element, add this custom CSS:

%%SELECTOR%% img {
aspect-ratio:1;
}
image-aspect-ratio-css

Set the aspect-ratio to 1 if you want to have a square image, or change it to 4/3, 16/9...

Changing the position

We can also change the position, with the object-position CSS property.
Why doing so ? Check the 2 following images. They both have the same aspect-ratio (21/9) but the right has a different position:

supamike_professional_photo_of_futuristic_time_travelling_car_a_f0bf88e9-57dc-489b-b4d0-6e3fed1b4ef9
aspect-ratio:21/9
supamike_professional_photo_of_futuristic_time_travelling_car_a_f0bf88e9-57dc-489b-b4d0-6e3fed1b4ef9
aspect-ratio:21/9
object-position:bottom;

To set the position, we just have to add the object-position property in our Custom CSS:

%%SELECTOR%% img {
aspect-ratio:21/9;
object-position:bottom;
}