CSS Selectors
In Cascading Style Sheet, every CSS rule consists of a selector and a declaration, The declaration is the rendering information to be applied to the selected elements while the selector is the pattern used to select the matched elements to be applied.
The CSS Selectors in alphabetic order
Property NameDescriptionCSS LevelRefRemark #idto match all elements with an "id" id1,2.1 last updated 11 Jan 2019*to match all elements2.1 last updated 11 Jan 2019.classto match all elements with a "class" class1,2.1 last updated 11 Jan 2019::after (:after)Insert something after the content of each <p> element last updated 11 Jan 2019::before (:before)Insert something before the content of each <p> element last updated 11 Jan 2019::cue (:cue) last updated 11 Jan 2019::grammar-error last updated 11 Jan 2019::marker last updated 11 Jan 2019::placeholderto select input elements with placeholder text last updated 11 Jan 2019::selectionto select the portion of an element that is selected by a user last updated 11 Jan 2019::slotted() last updated 11 Jan 2019::spelling-error last updated 11 Jan 2019:activeto select the active link1,2.1 last updated 11 Jan 2019:any-link last updated 11 Jan 2019:backdrop last updated 11 Jan 2019:blank last updated 11 Jan 2019:checkedto select every checked <input> element last updated 11 Jan 2019:current last updated 11 Jan 2019:defaultto select the default <input> element last updated 11 Jan 2019:defined last updated 11 Jan 2019:dir() last updated 11 Jan 2019:disabledto select every disabled <input> element last updated 11 Jan 2019:drop last updated 11 Jan 2019:emptyto select every <p> element that has no children (including text nodes) last updated 11 Jan 2019:enabledto select every enabled <input> element last updated 11 Jan 2019:first last updated 11 Jan 2019:first-childto select every <p> element that is the first child of its parent2.1 last updated 11 Jan 2019:first-letter (::first-letter)to select the first letter of every <p> element1,2.1 last updated 11 Jan 2019:first-line (::first-line)to select the first line of every <p> element1,2.1 last updated 11 Jan 2019:first-of-typeto select every <p> element that is the first <p> element of its parent last updated 11 Jan 2019:focusto select the input element which has focus2.1 last updated 11 Jan 2019:focus-visible last updated 11 Jan 2019:focus-within last updated 11 Jan 2019:fullscreen last updated 11 Jan 2019:future last updated 11 Jan 2019:has() last updated 11 Jan 2019:host last updated 11 Jan 2019:host() last updated 11 Jan 2019:host-context() last updated 11 Jan 2019:hoverto select links on mouse over2.1 last updated 11 Jan 2019:indeterminateto select input elements that are in an indeterminate state last updated 11 Jan 2019:in-rangeto select input elements with a value within a specified range last updated 11 Jan 2019:invalidto select all input elements with an invalid value last updated 11 Jan 2019:is() last updated 11 Jan 2019:lang(language)to select every <p> element with a lang attribute equal to "it" (Italian)2.1 last updated 11 Jan 2019:last-childto select every <p> element that is the last child of its parent last updated 11 Jan 2019:last-of-typeto select every <p> element that is the last <p> element of its parent last updated 11 Jan 2019:left last updated 11 Jan 2019:linkto select all unvisited links1,2.1 last updated 11 Jan 2019:local-link last updated 11 Jan 2019:not(selector)to select every element that is not a <p> element last updated 11 Jan 2019:nth-child(n)to select every <p> element that is the second child of its parent last updated 11 Jan 2019:nth-last-child(n)to select every <p> element that is the second child of its parent, counting from the last child last updated 11 Jan 2019:nth-last-of-type(n)to select every <p> element that is the second <p> element of its parent, counting from the last child last updated 11 Jan 2019:nth-of-type(n)to select every <p> element that is the second <p> element of its parent last updated 11 Jan 2019:only-childto select every <p> element that is the only child of its parent last updated 11 Jan 2019:only-of-typeto select every <p> element that is the only <p> element of its parent last updated 11 Jan 2019:optionalto select input elements with no "required" attribute last updated 11 Jan 2019:out-of-rangeto select input elements with a value outside a specified range last updated 11 Jan 2019:past last updated 11 Jan 2019:placeholder-shown last updated 11 Jan 2019:read-onlyto select input elements with the "readonly" attribute specified last updated 11 Jan 2019:read-writeto select input elements with the "readonly" attribute NOT specified last updated 11 Jan 2019:requiredto select input elements with the "required" attribute specified last updated 11 Jan 2019:right last updated 11 Jan 2019:rootto select the document's root element last updated 11 Jan 2019:scope last updated 11 Jan 2019:targetto select the current active #news element (clicked on a URL containing that anchor name) last updated 11 Jan 2019:target-within last updated 11 Jan 2019:user-invalid last updated 11 Jan 2019:validto select all input elements with a valid value last updated 11 Jan 2019:visitedto select all visited links1,2.1 last updated 11 Jan 2019[attribute$=value]to match all elements with [attribute] attribute containing word ends with string "value" last updated 11 Jan 2019[attribute*=value]to match all elements with [attribute] attribute containing word with substring "value" at the start, end or in the middle of the word. last updated 11 Jan 2019[attribute]to match all elements with an "attribute" attribute2.1 last updated 11 Jan 2019[attribute^=value]to match all elements with [attribute] attribute containing word begins with string "value" last updated 11 Jan 2019[attribute|=value]to match all elements with [attribute] attribute starting with the word "value" of either exactly "value" or "value" immediately followed by "-".2.1 last updated 11 Jan 2019[attribute~=value]to match all elements with [attribute] attribute containing the word "value"2.1 last updated 11 Jan 2019[attribute=value]to match all elements with [attribute] attribute equal to "value"2.1 last updated 11 Jan 2019columnA||tablecellBto match all <tablecellB> elements that belong to the scope of the <columnA> element. last updated 11 Jan 2019elementA elementBto match all <elementB> elements that are nested inside the <elementA> element1,2.1 last updated 11 Jan 2019elementA,elementB,⋯to match all <elementA>, <elementB>, <⋯>, ⋯ elements1,2.1 last updated 11 Jan 2019elementA~elementBto match all <elementB> elements that are preceded by the <elementA> element but not necessarily immediately inside the same parent element. last updated 11 Jan 2019elementA+elementBto match all <elementB> elements that are preceded immediately by the <elementA> element inside the same parent element.2.1 last updated 11 Jan 2019elementA>elementBto match all <elementB> elements that are direct children of the parent <elementA> element2.1 last updated 11 Jan 2019elementnameto match all <elementname> elements1,2.1 last updated 11 Jan 2019nth-col() last updated 11 Jan 2019nth-last-col() last updated 11 Jan 2019