Book Image

Practical Web Development

By : Paul Wellens
Book Image

Practical Web Development

By: Paul Wellens

Overview of this book

Table of Contents (23 chapters)
Practical Web Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
10
XML and JSON
Index

Styling anchors – pseudo-classes


We conclude our selection on CSS properties with the introduction of some pseudo-classes, typically but not solely used with <a>, the anchor tag. The anchor tag is used mainly for links. To make it visible that they are indeed links, the default styling of <a> happens to be a blue color and the text is underlined, which is not very attractive.

Using pseudo-classes, you can give an anchor tag, in theory any tag, a different look depending on where the cursor is, relative to the link and whether or not the link has already been visited. Here is an example:

a:link {
text-decoration:none;  /* switches off the underline */
}
a:hover {
color:white;   /* changes color to white when the curser hangs over it (hover)  */
}
a:visited {
color:yellow;   /* changes the color to indicate that you already visited that link */
}

Firebug

No matter how well you studied this chapter and various online references about CSS, from time to time things will not look as expected...