Selector Reference

Next ❯Examples

Selectors are being used to select elements you want/wish to design using css properties

SelectorsUsed
*To select all elements
elementTo select specific type of elements
#idNameTo select element with a specific 'id' name
.classNameTo select all elements with a specific 'class' name
.className.classNameNTo select all elements with a specific 'multiclass' names
element, elementTo select all specific group of elements

descendant selector [space]To select all specific child, grand-child, grand-grandchild and so on, of a specified element
child selector [>]To select all specific direct child of a specified element
adjacent sibling selector [+]To select all elements that are placed immediately after a specified element
general sibling selector [~]To select all elements that are siblings (sharing same parent) of a specified element

[attribute]To select all elements having specified attribute
[attribute="value"]To select all elements having specified attribute with specified value
[attribute|="value"]To select all elements having specified attribute with specified value equal to or followed by a hyphen(-)
[attribute~="value"]To select all elements having specified attribute containing a specified value
[attribute^="value"]To select all elements having specified attribute begins with specified value
[attribute$="value"]To select all elements having specified attribute ends with specified value
[attribute*="value"]To select all elements having specified attribute which contains substring as specified value

::afterTo insert content after a specified element
::beforeTo insert content before a specified element
::first-letterTo select first-letter of a specified element
::first-lineTo select first-line of a specified element
::placeholderTo select the placeholder value of a specified element
::selectionTo select the portion selected by a user of a specified element
::focus-within 
::marker 

:activeTo select active elements
:checkedTo select checked input element
:disabledTo select disabled element
:emptyTo select element that has no children & no text
:enabledTo select enabled element
:focusTo select input element that has focus
:hoverTo select the element when user mouse over them
:invalidTo select input element having invalid value
:linkTo select unvisited links
:optionalTo select input element which are not required
:requiredTo select input element which are required
:rootTo select the document's root element
:targetTo select the current active target element
:validTo select input element having valid value
:visitedTo select visited links

:in-rangeTo select input element having value within a specified range
:out-of-rangeTo select input element having value outside a specified range
:read-onlyTo select input element which are read-only
:read-writeTo select input element which are not read-only

:is(sp_selector) 
:lang(language)To select element with a "lang" attribute with specified value
:not(sp_selector)To select element which is not having specific-selector
:has(sp_selector)To select parent element which has having specific-selector as its child
:where(sp_selector) 

:first-childTo select element that are the first child of its parent
:first-of-typeTo select element that are the first of its type, of its parent
:last-childTo select element that are the last child of its parent
:last-of-typeTo select element that are the last of its type, of its parent
:only-childTo select element that are the only child of its parent
:only-of-typeTo select element that are the only child of its type, of its parent
:nth-child(n)To select element that are the nth child of its parent
:nth-of-type(n)To select element that are the nth child of its type, of its parent
:nth-last-child(n)To select element that are the nth child of its parent from last
:nth-last-of-type(n)To select element that are the nth child of its type, of its parent from last

  • Examples
❮ Prev Function Reference
Next ❯Examples
TryOut Examples"Learn to Explore..!"

TryOut Editor

receipt