Layout & CSS Core A2 · Formal specification Platform: Web

object-fit

`object-fit` controls how an image, video, or similar item fits inside its box.

See how it works
You might call it image fittingreplaced-element fit

See how it works

Original worked exampleobject-fit

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

  1. 01Content box
  2. 02Replaced media
  3. 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.

Request you can copy

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.

A2
How official is this term?

Formal specification

A published, versioned formal specification defines this term for the listed technical scope.

A formal document may still be a draft, release candidate, or final version. Check its status and browser or platform support.

Scope
CSS object sizing and fitting
Document status
draft
Checked on
2026-07-30

Evidence sources & scope

Authority source + Term reference · W3C CSS Working Group · draft CSS Images Module Level 3 — Sizing objects: object-fit Sizing objects: object-fit Scope: CSS replaced-object sizing and object fitting; direct scope: Sizing objects: object-fit Role here: Direct term reference Source covers: canonical name, definition, semantics, implementation Authority source · W3C CSS Working Group · draft CSS Images Module Level 3 Scope: CSS replaced-object sizing and object fitting Role here: Authority within stated scope Source covers: canonical name, definition, semantics, implementation Term reference W3C — CSS Images Level 3: Sizing Objects Role here: Direct term reference

Copy it yourself

The browser could not copy this. Select the request below and copy it yourself.