Creative workflow

Use CSS Object Position to Keep the Subject in a Mobile Crop

A graphite form rests low in a broad ivory sweep, with a small amber accent close beside it.

A fictional jar sits near the right edge of a wide storefront image. The image still fills its narrow card when centered, but the jar vanishes. We held the image and box size constant and moved only the position inside the box.

Quick answer

Start with object-fit: cover when the image must fill the slot. Adjust object-position on the cut-off axis. Preview the narrowest slot first and switch to a separate source image when movement alone cannot preserve the important details.

1. Identify which axis is cropped

Compare the box and image aspect ratios. Our narrow box is 148 by 160 CSS pixels including its border. Cover makes the wide source taller until it fills the content box, leaving horizontal overflow to crop. The visible edges can change again as the box gets wider.

2. Move the crop toward the subject

The example keeps the vertical value at 50%. Setting the horizontal value to 92% shifts the view toward the jar without rescaling the source. A percentage aligns a position on the image to the corresponding position in the box. It does not directly name a pixel coordinate in the original artwork.

3. Test the sizes that customers will see

Check the object and surrounding breathing room at the actual breakpoints. Keep critical copy in HTML where possible. If the subject and contextual detail still cannot fit together, prepare a specifically composed mobile source and use a picture element to switch at the relevant condition.

Start with the reference

The production Ciyo canvas holds the reference on the left and leaves an empty slot on the right.
The production Ciyo canvas holds the reference on the left and leaves an empty slot on the right.

Compare the two proofs in Ciyo

We imported the two proofs into a private production Ciyo project at the same scale and used Select to drag the comparison into place. This board shows the externally rendered or measured outputs for review.

The centered narrow crop shows only the mint surface. The right-biased crop reveals the jar and keeps the box full.

The centered narrow crop shows only the mint surface. The right-biased crop reveals the jar and keeps the box full.
Production Ciyo canvas showing both fictional proof states in separate layers.

Example files

Sources and related reading

Frequently asked questions

Why does the setting seem to do nothing at one width?

There may be no extra image area on that axis at that width. Test a smaller slot or inspect the rendered box and the source ratio.

When should I choose object-fit: contain?

Choose contain when you must show the entire source and blank space around it is acceptable. Cover prioritizes filling the available box.

Review a second version on the canvas

Keep both proofs at the same size and put the exact difference you reviewed in the handoff.