CSS Inheritance
Ereditarietà CSS
L'ereditarietà CSS permette ad alcune proprietà di copiare un valore da un elemento genitore. Questo accade quando il figlio non ha un valore proprio.
Un altro esempio
Un articolo imposta `color` e `font-family` una volta alla sua radice. Citazioni e parole all'interno ereditano quindi quegli stili. Un widget di acquisto può reimpostare gli stili di testo ereditati con token scope. `border` e `padding` non vengono ereditati, quindi il widget li imposta direttamente.
Parti principali
- 01Valore calcolato del genitore
- 02Proprietà ereditata
- 03Valore usato dal figlio
Usalo quando
Usa l'ereditarietà per stili di testo, colori e proprietà personalizzate che devono rimanere coerenti in una sezione.
Non usarlo quando
Non tutte le proprietà ereditano. Usa `inherit`, `initial`, `unset`, `revert` o `revert-layer` solo quando quella parola corrisponde al risultato che desideri.
Nome usato nel codice
inherit, initial, unset, revert, revert-layer, and inherited custom properties 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 Ereditarietà CSS (CSS Inheritance). User context: Un articolo imposta `color` e `font-family` una volta alla sua radice. Citazioni e parole all'interno ereditano quindi quegli stili. Un widget di acquisto può reimpostare gli stili di testo ereditati con token scope. `border` e `padding` non vengono ereditati, quindi il widget li imposta direttamente. Design concept to apply: Ereditarietà CSS (CSS Inheritance). Why it fits: Usa l'ereditarietà per stili di testo, colori e proprietà personalizzate che devono rimanere coerenti in una sezione. Do not use it when: Non tutte le proprietà ereditano. Usa `inherit`, `initial`, `unset`, `revert` o `revert-layer` solo quando quella parola corrisponde al risultato che desideri. 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 Ereditarietà CSS (CSS Inheritance) is used now. Definition: L'ereditarietà CSS permette ad alcune proprietà di copiare un valore da un elemento genitore. Questo accade quando il figlio non ha un valore proprio. 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.