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