用伪类:hover实现提示效果
在实现鼠标停在某元素上,会出现提示信息,以前我们太多是采用javascript脚本代码来实现。
看了怿飞的IE中伪类:hover的使用及BUG,我用CSS来实现同样的效果,看下例:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>返回蓝色理想首页</title>
<style>
* {
margin:0;
padding:0;
}
div {
margin:100px;
list-style:none;
}
div img {
border:0;
}
div a {
color:#fff;
text-decoration:none;
position:relative;
display:block;
}
div span {
font-size:12px;
display:none;
}
div a:hover {
background:;
}
div a:hover span {
padding:2px;
background:#ffc;
color:#000;
font-size:12px;
border-width:1px 2px 2px 1px;
border-color:#000000;
border-style:solid;
position:absolute;
top:-30px;
left:0;
display:block;
}
</style>
</head>
<body>
<div> <a href=”#” mce_href=”#” title=”"><img src=”http://case.blueidea.com/img/common/logo.gif” alt=”" /><span>返回蓝色理想首页</span></a>
</div>
</body>
</html>

