<p>例一:</p><pre class="brush:css;toolbar:false">/*css*/
a:link{
color:blue;
}
a:visited{
color:green;
}
a:hover{
color:red;
}
a:focus{
color:black;
}
a:active{
color:yellow;
}
/*html*/
<p><ahref="#">clickme</a></p></pre><p>例二:</p><pre class="brush:html;toolbar:false">/*css*/
input:focus{
background:yellow;
}
input:active{
background:red;
}
/*html*/
<inputtype="text"id="txt"></pre><p>link表示链接在正常情况下(即页面刚加载完成时)显示的颜色。</p><p>visited表示链接被点击后显示的颜色。</p><p>hover表示鼠标悬停时显示的颜色。</p><p>focus表示元素获得光标焦点时使用的颜色,主要用于文本框输入文字时使用(鼠标松开时显示的颜色)。</p><p>active表示当所指元素处于激活状态(鼠标在元素上按下还没有松开)时所显示的颜色。</p><p>注:伪类的顺序应为link--visited--hover--focus--active。</p>