Skip to content

Add CSS styling variable options into lead-image card #3

@dmnewcomb

Description

@dmnewcomb

Overview

The lead-image card defaults to a vertical view on mobile. The image fills up the space accordingly by using object-fit: cover but the image does get cropped in various ways that might not work great. We should allow users to edit this.

Default w/ object-position: 50% 50%; cuts off football
Screenshot 2024-04-01 at 9 49 07 AM

Edited to have object-position: 37% 50%; may be slightly better on most mobile formats
Screenshot 2024-04-01 at 10 04 09 AM

Recommended Solution

We have some control over what gets cropped on mobile through the object-position CSS property, and for the custom element we already have CSS variables to control this: --lead-image-object-position-horizontal-mobile and --lead-image-object-position-vertical-mobile.

We just need to add the ability to edit these CSS variables within the no-code tool.

For simplicity, for the object-position variables, I think we should allow the user to set a range from 0% to 100%. Looking at --podcast-grid-max-width (another CSS variable, for the podcast-grid custom element) in the menu-dev.js file could provide a reasonable example of how to enable this type feature within the no-code tool.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions