object-fit
object-fit
`object-fit` controlla come un'immagine, un video o un elemento simile si adatta all'interno della sua casella.
Un altro esempio
Un marketplace mette le foto dei venditori in una box 4:3 con `object-fit: cover`. Un punto focale salvato per `object-position` impedisce che un volto venga ritagliato sugli occhi. I diagrammi dei prodotti usano invece `contain`, aggiungendo spazio vuoto in modo che ogni nota resti visibile.
Parti principali
- 01Box di contenuto
- 02Media sostituito
- 03Adattamento e posizione focale
Usalo quando
Usa `cover` quando un ritaglio pianificato è accettabile. Usa `contain` quando ogni parte deve rimanere visibile, e testa media molto larghe e molto alte.
Non usarlo quando
Non usare `cover` per grafici, screenshot, codici QR o documenti. Ritagliarli può rimuovere informazioni necessarie.
Nome usato nel codice
object-fit: cover|contain + object-position Prima di spedire
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: Complete the task with object-fit (object-fit). User context: Un marketplace mette le foto dei venditori in una box 4:3 con `object-fit: cover`. Un punto focale salvato per `object-position` impedisce che un volto venga ritagliato sugli occhi. I diagrammi dei prodotti usano invece `contain`, aggiungendo spazio vuoto in modo che ogni nota resti visibile. Design concept to apply: object-fit (object-fit). Why it fits: Usa `cover` quando un ritaglio pianificato è accettabile. Usa `contain` quando ogni parte deve rimanere visibile, e testa media molto larghe e molto alte. Do not use it when: Non usare `cover` per grafici, screenshot, codici QR o documenti. Ritagliarli può rimuovere informazioni necessarie. 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): Un documento formale può ancora essere una bozza, un release candidate o la versione finale. Controlla il suo stato e il supporto per browser o piattaforma. Unknowns to confirm: Brand limits, amount of content, supported themes and languages, target devices, and design-system rules.
Controlla questa richiesta
Review how object-fit (object-fit) is used now. Definition: `object-fit` controlla come un'immagine, un video o un elemento simile si adatta all'interno della sua casella. 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, list the evidence, gaps, severity, and the smallest safe fix.