https://modern-css.com/reference/selectors/user-valid/
:user-valid | CSS Selectors & Pseudo-classes
Matches input elements after the user has modified them and they are valid. Provides user-driven validation feedback.
css selectors pseudouservalidclasses
https://modern-css.com/reference/selectors/id/
:id | CSS Selectors & Pseudo-classes
Targets a single, unique element on a page that has a matching 'id' attribute. Since IDs must be unique, this selector should only ever match one element.
css selectors pseudoidclasses
https://modern-css.com/reference/selectors/attribute/
:attribute | CSS Selectors & Pseudo-classes
Allows you to select elements based on the presence or value of their HTML attributes. This is powerful for styling elements like inputs with specific types or...
css selectors pseudoattributeclasses
https://modern-css.com/reference/selectors/view-transition-group/
::view-transition-group | CSS Selectors & Pseudo-classes
Targets the transition 'group' container for a specific named view transition. This is the container that holds both the 'old' and 'new' snapshots of an...
css selectors pseudoview transitiongroupclasses
https://modern-css.com/reference/selectors/target-after/
:target-after | CSS Selectors & Pseudo-classes
An experimental pseudo-class that matches a 'scroll marker' when it represents an item that comes AFTER the current viewport in a scroll container.
css selectors pseudotargetclasses
https://modern-css.com/reference/selectors/host/
:host() | CSS Selectors & Pseudo-classes
Allows you to style the 'host' (the custom element itself) from within the element's own Shadow DOM. It's the standard way to set a component's default...
css selectors pseudohostclasses
https://modern-css.com/reference/selectors/interest-target/
:interest-target | CSS Selectors & Pseudo-classes
Experimental: Targets the 'target' of an interest action (like the tooltip or popover itself) while it is currently being shown.
css selectors pseudointeresttargetclasses
https://modern-css.com/reference/selectors/picker-icon/
::picker-icon | CSS Selectors & Pseudo-classes
css selectors pseudopickericonclasses
https://modern-css.com/reference/selectors/checked/
:checked | CSS Selectors & Pseudo-classes
A pseudo-class that targets checkboxes, radio buttons, or option elements that are currently selected (checked) by the user.
css selectors pseudocheckedclasses
https://modern-css.com/reference/selectors/lang/
:lang | CSS Selectors & Pseudo-classes
Matches elements by language. Use to style different languages differently without adding classes.
css selectors pseudolangclasses
https://modern-css.com/reference/selectors/valid/
:valid | CSS Selectors & Pseudo-classes
Targets any form element that currently meets its requirements (like matching a 'pattern' or having content in a 'required' field). Unlike ':user-valid', this...
css selectors pseudovalidclasses
https://modern-css.com/reference/selectors/in-range/
:in-range | CSS Selectors & Pseudo-classes
Targets form inputs (like type='number') whose current value is between the minimum and maximum limits set by 'min' and 'max' attributes.
css selectors pseudorangeclasses
https://modern-css.com/reference/selectors/invalid/
:invalid | CSS Selectors & Pseudo-classes
Targets form inputs that contain data that doesn't follow the rules set by attributes like 'required', 'pattern', or 'type'.
css selectors pseudoinvalidclasses
https://modern-css.com/reference/selectors/scroll-marker-group/
::scroll-marker-group | CSS Selectors & Pseudo-classes
A new experimental pseudo-element that acts as a container for individual 'scroll markers'. It's used to create native CSS carousels with built-in navigation...
css selectors pseudoscrollmarkergroupclasses
https://modern-css.com/reference/selectors/defined/
:defined | CSS Selectors & Pseudo-classes
Matches any element that has been officially 'defined' by the browser. This includes all standard HTML elements and any custom elements that have been...
css selectors pseudodefinedclasses
https://modern-css.com/reference/selectors/visited/
:visited | CSS Selectors & Pseudo-classes
Matches any link that the user has already visited in their browser. For privacy reasons, the browser only allows you to change a few specific properties (like...
css selectors pseudovisitedclasses
https://modern-css.com/reference/selectors/nth-last-of-type/
:nth-last-of-type() | CSS Selectors & Pseudo-classes
css selectors pseudonthlasttypeclasses
https://modern-css.com/reference/selectors/default/
:default | CSS Selectors & Pseudo-classes
A pseudo-class that targets form elements (like buttons or checkboxes) that are the default among a set of similar elements.
css selectors pseudodefaultclasses
https://modern-css.com/reference/selectors/first-of-type/
:first-of-type | CSS Selectors & Pseudo-classes
A pseudo-class that targets the first element of its specific type within a parent. For example, 'p:first-of-type' targets the first paragraph, even if it's...
css selectors pseudofirsttypeclasses
https://modern-css.com/reference/selectors/modal/
:modal | CSS Selectors & Pseudo-classes
css selectors pseudomodalclasses
https://modern-css.com/reference/selectors/last-of-type/
:last-of-type | CSS Selectors & Pseudo-classes
css selectors pseudolasttypeclasses
https://modern-css.com/reference/selectors/muted/
:muted | CSS Selectors & Pseudo-classes
css selectors pseudomutedclasses
https://modern-css.com/reference/selectors/user-invalid/
:user-invalid | CSS Selectors & Pseudo-classes
Matches input elements after the user has modified them and they are invalid. Shows validation errors to users.
css selectors pseudouserinvalidclasses
https://modern-css.com/reference/selectors/dir/
:dir | CSS Selectors & Pseudo-classes
Matches elements based on text direction (ltr or rtl). Useful for bi-directional text layouts.
css selectors pseudodirclasses
https://modern-css.com/reference/selectors/view-transition-new/
::view-transition-new | CSS Selectors & Pseudo-classes
Targets the 'new' state's snapshot in a view transition. This is the image of how the element looks AFTER the change, allowing you to specifically animate how...
css selectors pseudoview transitionnewclasses
https://modern-css.com/reference/selectors/has-slotted/
:has-slotted | CSS Selectors & Pseudo-classes
Matches a 'slot' in the Shadow DOM if it contains content that matches the selector. It's used within Web Components to style slots based on what's been put...
css selectors pseudoslottedclasses
https://modern-css.com/reference/selectors/interest-source/
:interest-source | CSS Selectors & Pseudo-classes
Experimental: Targets an element that is currently the 'source' of interest (the element being hovered or focused) which is triggering an interest-based UI...
css selectors pseudointerestsourceclasses
https://modern-css.com/reference/selectors/is/
:is | CSS Selectors & Pseudo-classes
Matches any selector in its argument list. Useful for grouping related selectors.
css selectors pseudoclasses
https://modern-css.com/reference/selectors/popover-open/
:popover-open | CSS Selectors & Pseudo-classes
Matches elements with the popover attribute that are currently in their open state. It allows you to style top-layer content like menus and tooltips...
css selectors pseudopopoveropenclasses
https://modern-css.com/reference/selectors/highlight/
::highlight | CSS Selectors & Pseudo-classes
Targets custom text highlights created via the CSS Highlight API. It allows you to style specific ranges of text programmatically (ideal for...
css selectors pseudohighlightclasses
https://modern-css.com/reference/selectors/enabled/
:enabled | CSS Selectors & Pseudo-classes
A pseudo-class that targets form elements (like inputs or buttons) that are in an 'enabled' state and can be interacted with.
css selectors pseudoenabledclasses
https://modern-css.com/reference/selectors/fullscreen/
:fullscreen | CSS Selectors & Pseudo-classes
Targets an element while it is being displayed in the browser's full-screen mode (e.g., when a video or a photo is expanded to fill the whole monitor).
css selectors pseudofullscreenclasses
https://modern-css.com/reference/selectors/scroll-marker/
::scroll-marker | CSS Selectors & Pseudo-classes
A new experimental pseudo-element that represents an individual navigation dot in a carousel. You can style these dots (like an active/inactive state) directly...
css selectors pseudoscrollmarkerclasses
https://modern-css.com/reference/selectors/placeholder-shown/
:placeholder-shown | CSS Selectors & Pseudo-classes
css selectors pseudoplaceholdershownclasses
https://modern-css.com/reference/selectors/next-sibling/
:next-sibling | CSS Selectors & Pseudo-classes
Targets an element that is immediately following another element at the same level in the HTML structure.
css selectors pseudonextsiblingclasses
https://modern-css.com/reference/selectors/subsequent-sibling/
:subsequent-sibling | CSS Selectors & Pseudo-classes
Matched by the '~' symbol, this selector targets any siblings that come AFTER the specified element in the HTML. It doesn't have to be the very next sibling.
css selectors pseudosubsequentsiblingclasses
https://modern-css.com/reference/selectors/nth-last-child/
:nth-last-child() | CSS Selectors & Pseudo-classes
Works exactly like :nth-child(), but it counts backwards from the very last element in the container.
css selectors pseudolast childnthclasses
https://modern-css.com/reference/selectors/spelling-error/
::spelling-error | CSS Selectors & Pseudo-classes
A pseudo-element that allows you to customize the styling of words that the browser identifies as having spelling errors.
css selectors pseudospellingerrorclasses
https://modern-css.com/reference/selectors/before/
::before | CSS Selectors & Pseudo-classes
Creates a 'virtual' element that appears as the first child of the selected element. It's often used for quotes, bullet icons, or other decorative elements...
css selectors pseudoclasses
https://modern-css.com/reference/selectors/backdrop/
::backdrop | CSS Selectors & Pseudo-classes
Styles the area behind a full-screen element or dialog. It allows you to dim the background or add effects like blur when a modal is active.
css selectors pseudobackdropclasses
https://modern-css.com/reference/selectors/first-letter/
::first-letter | CSS Selectors & Pseudo-classes
A pseudo-element that targets the very first letter of the first line of a block-level element. perfect for creating drop caps.
css selectors pseudofirstletterclasses
https://modern-css.com/reference/selectors/view-transition-image-pair/
::view-transition-image-pair | CSS Selectors & Pseudo-classes
Targets the 'pair' of images (the old snapshot and the new snapshot) within a view transition group. This is where the cross-fade between the two states...
css selectors pseudoview transitionimagepairclasses
https://modern-css.com/reference/selectors/right/
:right | CSS Selectors & Pseudo-classes
A selector used in paged media (like printing) to style only the right-hand pages of a document (usually odd-numbered pages).
css selectors pseudorightclasses
https://modern-css.com/reference/selectors/xr-overlay/
xr-overlay | CSS Selectors & Pseudo-classes
An experimental pseudo-class that targets the root element of a 'DOM Overlay' when a web page is being viewed in an Immersive AR or VR environment.
css selectors pseudoxroverlayclasses
https://modern-css.com/reference/selectors/target-text/
::target-text | CSS Selectors & Pseudo-classes
A pseudo-element that allows you to style text that has been targeted via a URL fragment (the part after the # in a URL). This is often used for...
css selectors pseudotargettextclasses
https://modern-css.com/reference/selectors/nth-of-type/
:nth-of-type() | CSS Selectors & Pseudo-classes
Targets elements based on their position among siblings of the same type. For example, it can target 'the second image' even if there are paragraphs in between.
css selectors pseudonthtypeclasses
https://modern-css.com/reference/selectors/only-of-type/
:only-of-type | CSS Selectors & Pseudo-classes
Targets an element that is the ONLY child of its type among its siblings. For example, 'the only image' in a div, even if there's also text.
css selectors pseudotypeclasses
https://modern-css.com/reference/selectors/universal/
:universal | CSS Selectors & Pseudo-classes
The 'asterisk' selector that matches every single element on the page. It is commonly used in CSS resets to apply a base style (like 'box-sizing: border-box')...
css selectors pseudouniversalclasses
https://modern-css.com/reference/selectors/link/
:link | CSS Selectors & Pseudo-classes
css selectors pseudoclasses
https://modern-css.com/reference/selectors/only-child/
:only-child | CSS Selectors & Pseudo-classes
Targets an element that is the ONLY child of its parent. If there are any other elements (even of a different type), it won't match.
css selectors pseudochildclasses
https://modern-css.com/reference/selectors/view-transition-old/
::view-transition-old | CSS Selectors & Pseudo-classes
Targets the 'old' state's snapshot in a view transition. This is the image of how the element looked BEFORE the change, allowing you to animate how it fades...
css selectors pseudoview transitionoldclasses
https://modern-css.com/reference/selectors/hostfunction/
:hostfunction | CSS Selectors & Pseudo-classes
Used inside a Shadow DOM to style the 'host' element (the custom element itself). The functional version ':host()' lets you apply styles only if the host...
css selectors pseudoclasses
https://modern-css.com/reference/selectors/last-child/
:last-child | CSS Selectors & Pseudo-classes
Targets an element only if it is the very last child inside its parent container.
css selectors pseudolast childclasses
https://modern-css.com/reference/selectors/empty/
:empty | CSS Selectors & Pseudo-classes
A pseudo-class that targets any element that has absolutely no content inside it (not even whitespace or children).
css selectors pseudoemptyclasses
https://modern-css.com/reference/selectors/root/
:root | CSS Selectors & Pseudo-classes
css selectors pseudorootclasses
https://modern-css.com/reference/selectors/picker/
::picker | CSS Selectors & Pseudo-classes
css selectors pseudopickerclasses
https://modern-css.com/reference/selectors/host-context/
:host-context() | CSS Selectors & Pseudo-classes
A pseudo-class used in Web Components to style the custom element based on its position in the outside page (e.g., styling a component differently if it's...
css selectors pseudohostcontextclasses
https://modern-css.com/reference/selectors/disabled/
:disabled | CSS Selectors & Pseudo-classes
A pseudo-class that targets elements that are in a disabled state (like a button with the 'disabled' attribute), making them unclickable and often grayed out.
css selectors pseudodisabledclasses
https://modern-css.com/reference/selectors/descendant/
:descendant | CSS Selectors & Pseudo-classes
The most common CSS combinator (a simple space). It targets an element that is inside (a descendant of) another specified element, no matter how deeply nested.
css selectors pseudodescendantclasses
https://modern-css.com/reference/selectors/loop/
:loop | CSS Selectors & Pseudo-classes
css selectors pseudoloopclasses
https://modern-css.com/reference/selectors/stalled/
:stalled | CSS Selectors & Pseudo-classes
css selectors pseudostalledclasses
https://modern-css.com/reference/selectors/cue/
::cue | CSS Selectors & Pseudo-classes
A pseudo-element that allows you to style VTT (Video Text Tracks) cues, such as subtitles or captions, inside a media element.
css selectors pseudocueclasses
https://modern-css.com/reference/selectors/scroll-button/
::scroll-button | CSS Selectors & Pseudo-classes
A new pseudo-element that allows you to style the 'up', 'down', 'left', and 'right' buttons that appear in scrollable containers (like scrollbars).
css selectors pseudoscrollbuttonclasses
https://modern-css.com/reference/selectors/list/
:list | CSS Selectors & Pseudo-classes
A selector list is simply a comma-separated list of multiple selectors. If an element matches any one of the selectors in the list, the styles will be applied...
css selectors pseudolistclasses
https://modern-css.com/reference/selectors/file-selector-button/
::file-selector-button | CSS Selectors & Pseudo-classes
css selectors pseudofilebuttonclasses
https://modern-css.com/reference/selectors/view-transition-group-children/
view-transition-group-children | CSS Selectors & Pseudo-classes
An experimental selector used in the View Transition API to target and style the children within a view transition group.
css selectors pseudoview transitiongroupchildrenclasses
https://modern-css.com/reference/selectors/grammar-error/
::grammar-error | CSS Selectors & Pseudo-classes
Matches text that the browser has flagged as having a grammatical error. You can use this to change the color or style of the grammar correction underline.
css selectors pseudogrammarerrorclasses
https://modern-css.com/reference/selectors/child/
:child | CSS Selectors & Pseudo-classes
css selectors pseudochildclasses
https://modern-css.com/reference/selectors/search-text/
::search-text | CSS Selectors & Pseudo-classes
A pseudo-element that allows you to style text that matches a 'find in page' search query. This lets you customize how highlighted search results appear in...
css selectors pseudosearchtextclasses
https://modern-css.com/reference/selectors/left/
:left | CSS Selectors & Pseudo-classes
A selector used inside the @page rule to target the physical 'left' pages of a double-sided printed document.
css selectors pseudoleftclasses
https://modern-css.com/reference/selectors/not/
:not() | CSS Selectors & Pseudo-classes
Matches elements that do not match the list of selectors provided in its arguments. It allows you to exclude specific items from a general style rule.
css selectors pseudoclasses
https://modern-css.com/reference/selectors/first-child/
:first-child | CSS Selectors & Pseudo-classes
A pseudo-class that targets an element only if it is the very first child of its parent.
css selectors pseudofirst childclasses
https://modern-css.com/reference/selectors/marker/
::marker | CSS Selectors & Pseudo-classes
Targets the list item marker (usually the bullet point or number) of a list element. It allows you to style the bullet separately from the text of the list...
css selectors pseudomarkerclasses
https://modern-css.com/reference/selectors/active-view-transition/
:active-view-transition | CSS Selectors & Pseudo-classes
Matches elements that are currently participating in a view transition. This allows you to apply specific styles or animations exclusively while the transition...
css selectors pseudoview transitionactiveclasses
https://modern-css.com/reference/selectors/focus-within/
:focus-within | CSS Selectors & Pseudo-classes
Matches an element if it or any of its descendants have focus. Useful for form container styling.
css selectors pseudofocuswithinclasses
https://modern-css.com/reference/selectors/active/
:active | CSS Selectors & Pseudo-classes
Matches an element while it is actively being clicked or tapped. It's often used to give visual feedback (like a slight 'press' down effect) to the user.
css selectors pseudoactiveclasses
https://modern-css.com/reference/selectors/target-current/
:target-current | CSS Selectors & Pseudo-classes
An experimental pseudo-class that matches the 'scroll marker' corresponding to the item currently visible in the viewport. This is the 'active' state for...
css selectors pseudotargetcurrentclasses
https://modern-css.com/reference/selectors/nth-child/
:nth-child() | CSS Selectors & Pseudo-classes
Targets elements based on their position in a list. You can use numbers, formulas (like 2n for 'every second'), or keywords like 'odd' and 'even'.
css selectors pseudonthchildclasses
https://modern-css.com/reference/selectors/target-before/
:target-before | CSS Selectors & Pseudo-classes
An experimental pseudo-class that matches a 'scroll marker' when it represents an item that comes BEFORE the current viewport in a scroll container.
css selectors pseudotargetclasses
https://modern-css.com/reference/selectors/after/
::after | CSS Selectors & Pseudo-classes
Creates a 'virtual' element that appears as the last child of the selected element. It's commonly used for decorative elements like icons, dividers, or...
css selectors pseudoclasses
https://modern-css.com/reference/selectors/focus/
:focus | CSS Selectors & Pseudo-classes
A pseudo-class that targets an element that has been selected (e.g., clicked or tabbed to) and is ready to receive input.
css selectors pseudofocusclasses
https://modern-css.com/reference/selectors/column/
::column | CSS Selectors & Pseudo-classes
An experimental pseudo-element that allows you to style individual column boxes in a multi-column layout.
css selectors pseudocolumnclasses