selecteurs
Selecteurs, or selectors, are patterns used in CSS to identify elements in a document to which style rules apply. They form the core mechanism by which CSS selects elements for styling and interact with the cascade, inheritance, and specificity to determine the final presentation.
Basic selectors include type selectors (the name of an element like div or p), the universal selector
Combinators specify relationships between elements: a space denotes a descendant relationship, > selects direct children, + selects adjacent
Pseudo-classes and pseudo-elements extend selectors with state or generated content. Pseudo-classes such as :hover, :focus, and
Specificity and cascade: when multiple rules apply to the same element, the browser resolves conflicts using
Examples: p { color: blue; } changes all paragraph text to blue. .menu > li a:hover { text-decoration: underline; } applies
Notes: selectors should be clear and maintainable; very long or overly specific selectors can hinder readability
---