Selectors (1/3)
What is a CSS selector?

    A CSS selector is a pattern used to select and target HTML elements so that styles can be applied to them. It tells the browser which elements on the page should be affected by the CSS rules associated with the selector.

    Common Types of CSS Selectors
    • Universal Selector (*): Targets all elements on the page.
    • Element Selector (e.g., p, h1): Targets all instances of a specific HTML element.
    • Class Selector (.class-name): Targets elements with a specific class attribute.
    • ID Selector (#id-name): Targets a specific element with a unique ID.
    • Group Selector (e.g., h1, p, div): Applies the same style to multiple elements.
    • Descendant Selector (e.g., div p): Targets elements inside a specific parent.
    • Child Selector (e.g., div > p): Targets direct children only.
    • Attribute Selector (e.g., input[type='text']): Targets elements based on attributes.
    • Pseudo-class Selector (e.g., a:hover): Targets elements in a specific state.
    • Pseudo-element Selector (e.g., p::first-line): Styles specific parts of an element.