当前位置: 首页 > 图文教程 > 网页特效 > 鼠标代码 > 特殊的鼠标悬停提示(网页特效代码)
关键字
在实现鼠标停在某元素上,会出现提示信息,以前我们太多是采用javascript脚本代码来实现。我用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>返回软晨学习网(ruanchen.com)首页</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="http://www.ruanchen.com/"CURSOR: hand" onfocus="this.blur()" onclick="runEx('code')" type="button" value="运行代码" /> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
登陆 还没注册?