Code

Pseudo Classes

Psuedo classes are used to define a special state of an element. For example, it can style elements while being hovered, style visited and unvisited links differently, and style buttons while they are being clicked. These are typically used for links and buttons, but you can apply them to anything.

Pseudo classes with links

In order to style links using pseudo classes, go into your CSS. Then, type a:pseudoclass{}. To style the link the way it is, type a:link{}; to style a link after it is visited, type a:visited; to style a link while hovered, type a:hover{}, and to style a link while it is being clicked, type a:active{}. Here's an example:

This code yields the following result (with the right image being after link is hovered over):

Hover classes with other elements

You don't always have to use pseudo classes with links; you can use them with anything else, including divs, images, and even classes. The example below shows how hovering over an image allows one to view it from close up:

This code yields the following result: