不使用javascript,使用CSS和HTML实现鼠标经过图片变换图片效果。演示地址。代码:
<!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> <title>不用javascript,使用CSS和HTML实现鼠标经过图片变换图片效果</title> <style> .main{ width:332px; height:113px; border:1px solid gray; } .content{ width:332px; height:113px; border:1px solid gray; background-image:url(images/1.jpg); background-repeat: no-repeat; } .content:hover{ background-image:url(images/2.jpg); } a{ text-decoration:none; } </style> </head> <body> <div class="main"> <a href="http://www.91ctc.com/"><div class="content"></div></a> </div> </body> </html>
相关推荐: