Pseudo classes and elements

In CSS, there are also a few instructions that let you make changes that will work under very specific circumstances. They are called pseudo-classes and pseudo-elements, and they all go next to the tag you are modifying. Just be careful because they don't always work in every browser.

:active adds style to an activated element

:focus adds style to an element while the element has focus, I usually use it together with :hover

:hover adds style to an element when the mouse is over it

:first-child adds style to an element that is the first child of some other element

:first-letter adds style to the first letter of a text

:first-line adds style to the first line of a text

For example, Heptagrama has this CSS instructions for its links:

a {
color: #f7d235;
text-decoration: none;
font-style: italic}

a:hover, a:focus, a:visited {
color: #ffb432}


Knowledge + Computers