clamp()
clamp()
`clamp()` sceglie un valore CSS preferito ma lo mantiene tra un minimo e un massimo.
Un altro esempio
Un titolo utilizza `clamp(2rem,1.2rem + 3vw,4.5rem)`. Cresce in modo fluido dal telefono al desktop, ma non scende mai sotto i 32px né supera i 72px. Poiché la regola mantiene le unità `rem`, lo zoom del browser funziona ancora.
Parti principali
- 01Minimo
- 02Espressione preferita
- 03Massimo
Usalo quando
Usalo per un valore che dovrebbe cambiare in modo fluido ma rimanere entro limiti chiari e leggibili. Combina unità relative e viewport quando utile.
Non usarlo quando
Per il testo, non usare solo unità di viewport come valore preferito. Testare zoom, schermi corti e traduzioni molto lunghe.
Nome usato nel codice
clamp(minimum, preferred, maximum) 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 clamp() (clamp()). User context: Un titolo utilizza `clamp(2rem,1.2rem + 3vw,4.5rem)`. Cresce in modo fluido dal telefono al desktop, ma non scende mai sotto i 32px né supera i 72px. Poiché la regola mantiene le unità `rem`, lo zoom del browser funziona ancora. Design concept to apply: clamp() (clamp()). Why it fits: Usalo per un valore che dovrebbe cambiare in modo fluido ma rimanere entro limiti chiari e leggibili. Combina unità relative e viewport quando utile. Do not use it when: Per il testo, non usare solo unità di viewport come valore preferito. Testare zoom, schermi corti e traduzioni molto lunghe. 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 clamp() (clamp()) is used now. Definition: `clamp()` sceglie un valore CSS preferito ma lo mantiene tra un minimo e un massimo. 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.