1button:hover {
2 color: blue;
3}
4
5A pseudo-class is a word such as :hover that makes its changes
6to the selected element by adding it along side the selector
7before the curly braces in CSS instead of inside the curly
8braces.
9
10You can search for a list of pseudo-class online.
11
12
1a:linklink in normal state
2a:activelink in clicked state
3a:hoverlink with mouse over it
4a:visitedvisited link
5p::after{content:"yo";}add content after p
6p::beforeadd content before p
7input:checkedchecked inputs
8input:disableddisabled inputs
9input:enabledenabled inputs
10input:focusinput has focus
11input:in-rangevalue in range
12input:out-of-rangeinput value out of range
13input:validinput with valid value
14input:invalidinput with invalid value
15input:optionalno required attribute
16input:requiredinput with requred attribute
17input:read-onlywith readonly attribute
18input:read-writeno readonly attrib.
19div:emptyelement with no children
20p::first-letterfirst letter in p
21p::first-linefirst line in p
22p:first-of-typefirst of some type
23p:last-of-typelast of some type
24p:lang(en)p with en language attribute
25:not(span)element that's not a span
26p:first-childfirst child of its parent
27p:last-childlast child of its parent
28p:nth-child(2)second child of its parent
29p:nth-child(3n+1)nth-child (an + b) formula
30p:nth-last-child(2)second child from behind
31p:nth-of-type(2)second p of its parent
32p:nth-last-of-type(2)...from behind
33p:only-of-typeunique of its parent
34p:only-childonly child of its parent
35:rootdocuments root element
36::selectionportion selected by user
37:targethighlight active anchor
1A pseudo-class is a selector that selects elements that are in a specific state, e.g. they are the first element of their type, or they are being hovered over by the mouse pointer
1 /* unvisited link */
2a:link {
3 color: #FF0000;
4}
5
6/* visited
7link */
8a:visited {
9 color: #00FF00;
10}
11
12/* mouse over link */
13
14a:hover {
15 color: #FF00FF;
16}
17
18/* selected link */
19a:active {
20
21 color: #0000FF;
22}