object-fit
`object-fit` controls how an image, video, or similar item fits inside its box.
Another example
A marketplace puts seller photos in a 4:3 box with `object-fit: cover`. A saved focal point for `object-position` keeps a face from being cropped at the eyes. Product diagrams use `contain` instead, adding empty space so every note stays visible.
Main parts
- 01Content box
- 02Replaced media
- 03Fit and focal position
Use it when
Use `cover` when a planned crop is okay. Use `contain` when every part must stay visible, and test very wide and very tall media.
Do not use it when
Do not use `cover` for charts, screenshots, QR codes, or documents. Cropping them can remove needed information.
Name used in code
object-fit: cover|contain + object-position Before you ship
Check content order, shared design values, component consistency, contrast, zoom, and layout changes by screen size. Verify every theme, language, and state. If there is motion, offer an equal reduced-motion experience.
Outcome: Use or define object-fit to make the visual experience clear and easy to use. User context: A marketplace puts seller photos in a 4:3 box with `object-fit: cover`. A saved focal point for `object-position` keeps a face from being cropped at the eyes. Product diagrams use `contain` instead, adding empty space so every note stays visible. Design concept to apply: object-fit. Why it fits: Use `cover` when a planned crop is okay. Use `contain` when every part must stay visible, and test very wide and very tall media. Do not use it when: Do not use `cover` for charts, screenshots, QR codes, or documents. Cropping them can remove needed information. Design requirements: Set the content order, shared design values, and reusable components. Define how the layout changes by screen size and state. Keep useful design choices separate from decoration. Inclusion and resilience: Check contrast, zoom, languages, themes, and reduced motion when needed. Do not use color or effects as the only way to show meaning. Acceptance criteria: The design stays clear on phones and desktops, at zoom, in every theme, and in all supported languages. Interactive states stay clear and consistent. Evidence and limits (evidence boundary): A formal document may still be a draft, release candidate, or final version. Check its status and browser or platform support. Unknowns to confirm: Brand limits, amount of content, supported themes and languages, target devices, and design-system rules.
Check this request
Review the current use of object-fit. Definition: `object-fit` controls how an image, video, or similar item fits inside its box. Release checks: Check content order, shared design values, component consistency, contrast, zoom, and layout changes by screen size. Verify every theme, language, and state. If there is motion, offer an equal reduced-motion experience. Before changing code, report the evidence you found, gaps, severity, and the smallest safe fix.