Maison  >  Article  >  interface Web  >  鼠标悬浮实现链接背景变色效果_html/css_WEB-ITnose

鼠标悬浮实现链接背景变色效果_html/css_WEB-ITnose

WBOY
WBOYoriginal
2016-06-24 11:29:542209parcourir

鼠标悬浮实现链接背景变色效果:
本章节分享一段代码实例,它能够实现鼠标悬浮链接实现背景变色效果。
代码实例如下:

<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">a{  display:block;  width:140px;  height:30ox;   line-height:30px;  background-color:#94b8e9;  border:1px solid black;  color:#000;  text-decoration:none;  text-align:center;}a:hover{  background-color:#369;  color:#fff;}</style></head><body><a href="http://www.softwhy.com">蚂蚁部落</a></body></html>

以上代码实现了我们的要求,当鼠标悬浮设置背景色是利用了,链接伪类a:hover。

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=13421

更多内容可以参阅:http://www.softwhy.com/divcss/

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn