Introduction to CSS Pseudoclasses

Notes:

Intro to Pseudo Class Selectors (Colon)
Pseudo class selectors are used to select HTML elements based on their current status and apply styles on them.

Syntax of Pseudo Class Selector:
selector: pseudo class keyword
{
declaration list;
}
It selects any HTML element targeted by the selector, and applies specified styles based on the pseudo class keyword used

Syntax for “hover” pseudo class selector:
selector : hover
{
declaration list;
}
It selects any HTML element targeted by the selector, if its status is hovered (on mouse over)

Ex:
a:hover
{
background-color : orange;
}
It selects any anchor element, if its status is hovered

Interview Questions: