- Description:
This key defines how images fit within their containers in the gallery section of a Card.
Valid values are
padded(default),contain,cover, orcover-top.- The
paddedvalue adds padding around images to maintain aspect ratio. - The
containvalue ensures images fit entirely within the container by setting the largest dimension of the image to the largest dimension of the container, while maintaining aspect ratio. - The
covervalue ensures images cover the entire container while maintaining aspect ratio, aligning the center of the image with the center of the container. - The
cover-topvalue ensures images cover the entire container while maintaining aspect ratio, aligning the top of the image with the top of the container.
This key defaults to
contain.- The
- Appears in:
- Type:
string- Default value:
padded- Allowed values:
paddedcovercontaincover-top- Examples:
In this example, we have configured the gallery fit to use
coverso images cover the entire container while maintaining aspect ratio, aligning the center of the image with the center of the container.Copied to clipboardcollections_config: blog: preview: gallery: image: - key: featured_image fit: cover{ "collections_config": { "blog": { "preview": { "gallery": { "image": [ { "key": "featured_image" } ], "fit": "cover" } } } } }