CSS: Pseudo-Class Selectors

By Xah Lee. Date: . Last updated: .

These are misc CSS: What is Pseudo Class selectors.

Match Links

a:link

Match a link.

a:visited

Match visited link.

/* make link to have underline only when mouse hovers over it */

a:visited, a:link {text-decoration:none;}

a:hover {text-decoration:underline;}

Match User Action

tag:hover

mouse hover over a element tag

tag:active

Match a link that's clicked on but mouse button not yet released.

tag:focus

when a element is in focus (receive keys, etc. Click on a element to put focus to it.)

Match Target

tag:target

Match tag that has a id attribute value same as the current URL #fragment.

User Interface Pseudo-Class

tag:enabled

Match a user interface tag that is enabled.

tag:disabled

Match a user interface tag that is disabled

tag:checked

Match a user interface tag which is checked (example: radio-button, checkbox)

tag:indeterminate

?

Match Language

tag:lang(v)

Match tag if its value of lang attribute is v.

/* make Chinese paragraphs red. */

p:lang(zh) {color:red;}

CSS Selectors