css鼠标悬停连接变化图片,点击后,图片不换,怎么实现?

cnvxun 2009-07-15 10:33:46
原来是这样的:图片链接
<a href="1.ASP" style="cursor:pointer">
<img src="images/1_a.gif" name="Image14" width="170" height="81" border="0">
</a>
离开链接后,图片是images/1_a.gif;
当鼠标悬停的时候,图片要变换成:images/1_b.gif

光这2个功能,我能通过css实现。
我现在要不仅仅实现以上2个功能,同时我还要点击过这个链接后,图片就是images/1_b.gif。

这个该如何实现呢?

麻烦给出整体代码来。谢谢啊。
...全文
1074 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
岑子哥 2009-07-15
  • 打赏
  • 举报
回复
这样最简单:
a:link, a:visited{background:url(images/1_b.gif ) no-repeat; width:170px; height:81px;display:inline-block;}
a:hover, a:active{background:url(images/1_b.gif ) no-repeat; width:170px; height:81px;}
夜雨_Jason 2009-07-15
  • 打赏
  • 举报
回复
a:visited
打字员 2009-07-15
  • 打赏
  • 举报
回复
分开来写

a:link{background:url(1_a.gif)}

a:visited{background:url(1_b.gif)}

a:hover,a:active{background:url(1_b.gif)}

另外如果a 的href相同的话,就在后面加一随机数.
打字员 2009-07-15
  • 打赏
  • 举报
回复
分开来写

a:link{background:url(1_a.gif)}

a:visited{background:url(1_b.gif)}

a:hover,a:active{background:url(1_b.gif)}

另外如果a 的href相同的话,就在后面加一随机数.
bingai0220 2009-07-15
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 cnvxun 的回复:]
引用 2 楼 cenzige 的回复:
这样最简单:
a:link, a:visited{background:url(images/1_b.gif ) no-repeat; width:170px; height:81px;display:inline-block;}
a:hover, a:active{background:url(images/1_b.gif ) no-repeat; width:170px; height:81px;}




你这个方法只适合1个图片链接。

我有4个这样的图片链接,那每一个点完,那不都是b的图片了?
[/Quote]
楼主可以针对不同的选择器搞啊。
cnvxun 2009-07-15
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 cenzige 的回复:]
这样最简单:
a:link, a:visited{background:url(images/1_b.gif ) no-repeat; width:170px; height:81px;display:inline-block;}
a:hover, a:active{background:url(images/1_b.gif ) no-repeat; width:170px; height:81px;}
[/Quote]


你这个方法只适合1个图片链接。

我有4个这样的图片链接,那每一个点完,那不都是b的图片了?
cnvxun 2009-07-15
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 cenzige 的回复:]
这样最简单:
a:link, a:visited{background:url(images/1_b.gif ) no-repeat; width:170px; height:81px;display:inline-block;}
a:hover, a:active{background:url(images/1_b.gif ) no-repeat; width:170px; height:81px;}
[/Quote]

你这方法还是不行。

61,110

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧