CSS and Link

CSS can be written two ways. The first way has selector and second way does not have selector but class selectors only.

First way:

sty
{ color: #333333;
}

First way covers every situation of class selectors. One for all. However, if a particular situation, say “hover” is needed to be excluded from the uniform of selector, it can be added as an overwrite:

sty
{ color: #333333;
}
sty:hover
{ color: #CCCCCC;
}

Second way:

sty:link
{ color: #333333;
}
sty:visited
{ color: #FFFFFF;
}
sty:hover
{ color: #CCCCCC;
}
sty:active
{ color: #333333;
}
Using second way, one must specify every situation. Else, it would inherited from the rule that is used by the element in which the link exists. For 2nd way, there is an order requirement: LoVe/HAte, else, it won't work.

The CSS can be not only used for link, but text as well. However, to enable class selectors work properly, the anchor must be exist:

‹a href="http://koncordpartners.blogspot.com" class="sty"›
This is the anchor started with letter “a”. If no link needed, use this href: href="#".
‹/a›

It also means applying class at table or cell/td level won'd work.


http://www.projectseven.com/tutorials/css/pseudoclasses/

No comments:

Post a Comment

Labels