如何使用CSS :hover 选择器
1、代码实例。从这个实例我们可 以明白,a选择器会发挥作用。
a:hover{ background-color:yellow;}

2、主流的浏览器都支持这样的一个代码的应用。

3、规则。这个鼠标效果必须在一系列的其它效果之后发挥自己的作用。下面的这些代码的优先级次序可以一一浏览清楚。
a:link {color:blue;}a:visited {color:blue;}a:hover {color:red;}a:active {color:yellow;}

4、我们可以为不同的链接赋予不同的 hover 效果。
<style>
a.ex1:hover,a.ex1:active {color:red;}
a.ex2:hover,a.ex2:active {font-size:150%;}
a.ex3:hover,a.ex3:active {background:red;}
a.ex4:hover,a.ex4:active {font-family:'雅黑';}
a.ex5:visited,a.ex5:link {text-decoration:none;}
a.ex5:hover,a.ex5:active {text-decoration:underline;}
</style>

5、CSS :focus 选择器 ,这个代码表明在特定的元素窗口,会在操作前有一个样式的告示。

6、代码应用实例:我们在窗口点击一下鼠标,这个窗口的背景就会有颜色变化!
<style>
input:focus
{
background-color:yellow;
}
</style>
</head>
<body>
景:
<form>
First name: <input type="text" name="firstname" /><br>
Last name: <input type="text" name="lastname" />
</form>
</body>
