Try my app Expense Manager @ google play and amazon store.

Wednesday, May 9, 2012

CSS Beginner tutorial 9 : Pseudo Classes

Many CSS proposals are not supported by all browsers, but there are four pseudo classes that can be used safely when applied to links. Pseudo classes are bolted on to selectors to specify a state or relation to the selector. They take the form of selector:pseudo class, simply with a colon in between the selector and the pseudo class. For example property: value;

The four pseudo classes that can be used safely when applied to links are following.

link :
It is for an unvisited link.
visited :
It is for a link to a page that has already been visited.
active :
It is for a link when it is gains focus, for example, when it is clicked on.
hover :
It is for a link when the cursor is held over it.

CSS Code for above four classes are :

a.snow:link {
color: blue;

a.snow:visited {
color: purple;

a.snow:active {
color: red;

a.snow:hover {
text-decoration: none;
color: blue;
background-color: yellow;

Although CSS gives you control to bypass it, maintaining different colours for visited links is good practice as many users still expect this. As pseudo classes (other than hover) are not often used, this is a feature that is unfortunately not as common as it once was. Because of this, it is less important than it used to be, but if you are looking for the optimum user response, then you should use it.

Traditionally, text links were blue if not visited and purple if visited, and there is still reason to believe that these are the most effective colours to use, although, again, with the increasingly widespread use of CSS, this is becoming less commonplace and the average user no longer assumes that links must be blue or purple.

1 comment:

Follow by Email

Google+ Badge