CSS
HTML
JavaScript
jQuery
PHP
SQL
WordPress
CSS Reference

Quick Reference

This is a quick reference list of CSS selectors and how they work in selecting HTML elements to apply styling.

CSS – * Selector

The * selector selects all HTML elements in the document, and if used together with another element can be used to select all that element’s child elements.

CSS – [attribute*=value] Selector

The [attribute*=value] selector selects every element with a specific attribute that has a value containing a specified string even as part of another word.

CSS – :checked Selector

The :checked selector matches every checked input element for radio buttons, checkboxes, and option elements.

CSS – .class Selector

The .class selector selects all HTML elements with a specific class, which may include multiple elements on the page.

CSS – Element ~ Element Selector

The element ~ element selector selects sibling elements that appear after the specified element. Both of the specified elements must share the same parent.

CSS – :first-child Selector

The :first-child selector selects all HTML elements of a specified type that are also the first child of their parent element.

CSS – : empty Selector

The :empty selector selects empty HTML elements, which means an element without any child elements or text.

CSS – ::first-line Selector

The ::first-line selector is used to select the first line of text of a specified, block-level element such as a paragraph or heading.

CSS – :hover Selector

The :hover selector selects elements when you mouse over them, and is commonly used for links and images with links, but can be used on any element.

CSS – #id Selector

The #id selector selects an HTML element with a specific id. HTML only allows for one unique #id per document.

CSS – :in-range Selector

The :in-range selector selects elements with a value that is within a specified range, and only works for input elements with min/max attributes.

CSS – :invalid Selector

The :invalid selector selects form elements with a value that does not validate according to the element’s settings.

CSS – :lang Selector

The :lang selector is used to select elements with a lang attribute with a specified value (e.g., lang = “en” or lang = “en-us”).

CSS – :last-child Selector

The :last-child selector selects all HTML elements of a specified type that are also the last child of their parent element.

CSS – :link Selector

The :link selector is used to select unvisited links, and will not style links you have already visited.

CSS – :nth-child() Selector

The :nth-child() selector selects all specified elements that are the nth child of their parent, regardless of all the children’s types.

CSS – :only-child Selector

The :only-child selector selects every element that is the only child of its parent. If the parent has multiple child elements, it will NOT be selected.

CSS – :out-of-range Selector

The :out-of-range selector selects elements with a value that is NOT within a specified range, and only works for input elements with min/max attributes.

CSS – :read-write Selector

The :read-write selector selects form inputs which are “readable” and “writeable” (those with no “readonly” or “disabled” attributes).

CSS – ::selection Selector

The ::selection selector matches the portion of an element that is selected by a user, and is most often used to set the background color of selected text.

CSS – :target Selector

The :target selector selects the current active target anchor element on the page (the element being linked to).

CSS – :valid Selector

The :valid selector selects form inputs with a value that properly validates according to the element’s settings.

We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.

CSS
HTML
JavaScript
jQuery
PHP
SQL
WordPress

Why 1SMARTchicken?

This site was built and is maintained to benefit my autistic son.
See More →

My Son's Name is Johnny

He was diagnosed as autistic quite late, at age four...
His story

Buy Me a Coffee

Thanks for your support!

Feedback

If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.