Skip to content
View in the app

A better way to browse. Learn more.

OKCCN - XenForo & IPS Plugin Marketplace

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
  • Language

CSS Pseudo-classes

Featured Replies

  • Administrators

CSS Pseudo-classes


CSS Pseudo-classes

A CSS pseudo-class is a keyword that can be added to a selector, to define a style for a special state of an element.

Some common use for pseudo-classes:

  • Style an element when a user moves the mouse over it
  • Style visited and unvisited links differently
  • Style an element when it gets focus
  • Style valid/invalid/required/optional form elements
  • Style an element that is the first child of its parent

Syntax

Pseudo-classes are always denoted by a single colon (:) followed by the pseudo-class name:

selector:pseudo-class-name {
  CSS properties
}

Mouse Over Me


Interactive Pseudo-classes

Interactive pseudo-classes apply styles based on user interaction:

  • :hover - When mouse is over an element
  • :focus - When an element has focus
  • :active - When an element is being activated
  • :link - Unvisited links
  • :visited - Visited links

Learn more about Interactive Pseudo-classes »


Structural Pseudo-classes

Structural pseudo-classes select elements based on their position in the document tree:

  • :first-child - First child of a parent
  • :last-child - Last child of a parent
  • :nth-child(n) - The nth child of a parent
  • :lang() - Elements with a specific language

Learn more about Structural Pseudo-classes »



CSS Pseudo-classes Reference

For a complete list of all CSS Pseudo-classes, visit our CSS Pseudo-classes Reference.


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.