width / height
. To measure the aspect ratio of an image or video, divide the width by the height. For example, an image or video that is 400x300 pixels and one that is 260x195 pixels have the same ratio 4/3 (standard).
ratio
prop is set to standard. The aspect ratio is 4/3.ratio
prop is set to square. The aspect ratio is 1/1.ratio
prop is set to wide. The aspect ratio is 16/9.ratio
prop is set with --e-bolt-aspect-ratio
via inline CSS style. The aspect ratio is 7/3.{% set image %}
{% include '@bolt-elements-image/image.twig' with {
attributes: {
alt: 'Alt text.',
src: 'https://via.placeholder.com/400x300',
width: 200,
height: 200,
},
} only %}
{% endset %}
{% include '@bolt-elements-ratio/ratio.twig' with {
content: image,
ratio: 'square',
} only %}
<div class="e-bolt-ratio e-bolt-ratio--square">
<!-- image or video goes here -->
</div>