CSS Selector
Selettore CSS
Un selettore CSS è un modello che trova elementi su una pagina in modo che possano essere applicati loro degli stili.
Un altro esempio
Un sistema di design seleziona `[data-state='open']` su una disclosure invece di `.blue-chevron`. Un redesign visivo non lo rompe. Dove supportato, `:has(> input:invalid)` applica stili a un gruppo di campi con un input non valido. Il testo di errore dal server rimane il fallback funzionante.
Parti principali
- 01selettori composti
- 02Combinatori
- 03Soggetto corrispondente
Usalo quando
Scegli hook stabili che descrivano il significato. Mantieni la specificità bassa quanto utile ed evita di dipendere da una profondità DOM esatta.
Non usarlo quando
Evitare selettori denominati in base all'aspetto, al markup generato o a lunghe catene di elementi figli. Rende i cambiamenti successivi rischiosi.
Nome usato nel codice
type, class, ID, attribute, combinator, pseudo-class, and pseudo-element selectors 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 Selettore CSS (CSS Selector). User context: Un sistema di design seleziona `[data-state='open']` su una disclosure invece di `.blue-chevron`. Un redesign visivo non lo rompe. Dove supportato, `:has(> input:invalid)` applica stili a un gruppo di campi con un input non valido. Il testo di errore dal server rimane il fallback funzionante. Design concept to apply: Selettore CSS (CSS Selector). Why it fits: Scegli hook stabili che descrivano il significato. Mantieni la specificità bassa quanto utile ed evita di dipendere da una profondità DOM esatta. Do not use it when: Evitare selettori denominati in base all'aspetto, al markup generato o a lunghe catene di elementi figli. Rende i cambiamenti successivi rischiosi. 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 Selettore CSS (CSS Selector) is used now. Definition: Un selettore CSS è un modello che trova elementi su una pagina in modo che possano essere applicati loro degli stili. 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.